- Login as root
- Create a script addftpspecial :-
#!/bin/ksh
if [ "$1" = "" -o "$2" = "" ]
then
echo Usage: $0 username subdir
exit
fi
useradd -d /FTPSites/WarehouseOptimizationFTP/$2 -g WOFTP -M -s /usr/sbin/nologin $1
- Run the script addftpspecial with the userename and the home directory for the user. The script is in the root home directory on ftp server.
# ./addftpspecial username ftpsubdirectory
Note:- for root of the ftp directory use this
# ./addftpspecial ftpwonewuser ./ (this will place the user in the /FTPSites/WarehouseOptimizationFTP/ directory)
Note:- The addftpspecial script add's primary group as WOFTP for the new user, so if you want the user to have access only to his directory then do the following commands
# groupadd username (this will create a group with the same name as the userename)
# usermod -g username username (this command will put the new group as the primary group)
- Use the passwd command to assign a password to the user
# passwd username
- Go to the directory /etc
# cd /etc
- Edit the file vsftp.chroot_list.
# vi vsftp.chroot_list (add username to list of users - this file causes the user to be locked into their home directory)
# grep username passwd (show username from password file - copy directory name from information)
# mkdir directory-copied-from-passwd
# chown username:WOFTP directory-copied-from-passwd (adding the WOFTP group will give the group permission to everyone who is in the WOFTP group for the new user directory)
# chmod 775 directory-copied-from-passwd (This will give full permission to the group WOFTP)
No comments:
Post a Comment