linux 创建受限制的用户

#!/bin/bash
    username="xianziuser"
    cp -a /bin/bash /bin/rbash
    useradd -c "A Restricted User" -g users -d /home/$username -s /bin/rbasusername
    rm -rf /home/$username; mkdir -m 555 /home/$username
    mkdir -m 555 /home/$username/bin
    cp -a /bin/ls /home/$username/bin
    cp -a /usr/bin/passwd /home/$username/bin
    echo "export PATH=/home/$username/bin" > /home/$username/.bash_profile
    chmod 444 /home/$username/.bash_profile
    passwd $username