Created
January 11, 2012 19:53
-
-
Save fgbreel/1596443 to your computer and use it in GitHub Desktop.
Script para criar usuários de sftp.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
user=$1 | |
if useradd -G sftponly -s /bin/false -m ${user} | |
then | |
mkdir -p /chroot/${user}/home/${user} | |
chown ${user}.root /chroot/${user}/home/${user} | |
cp -pr /etc/skel/* /chroot/${user}/ | |
chown root.root /chroot/${user} | |
chmod 711 /chroot/${user} | |
elif [ "$?" == 9 ] | |
then | |
echo "O usuário já existe" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment