I’m making a bash script which should create an ftp user.
ftpasswd --passwd --file=/usr/local/etc/ftpd/passwd --name=$USER --uid=[xxx]
--home=/media/part1/ftp/users/$USER --shell=/bin/false
The only supplied argument to script is user name. But ftpasswd also requires uid. How do I get this number? Is there an easy way to scan passwd file and get the max number, increment it and use it? Maybe it’s possible to obtain that number from the system?
To get a user’s UID:
To add a new user to the system the best option is to use
useradd, oradduserif you need a fine-grained control.If you really need just to find the smallest free UID, here’s a script that finds the smallest free UID value greater than 999 (UIDs 1-999 are usually reserved to system users):