I have raspberry pi 2 with the latest raspian and I am trying to set up an FTP server using this guide.
I am stuck at the part of
useradd ftpuser -g ftpgroup -s /sbin/nologin –d
/dev/null
when I hit enter (as sudo or as pi) it prints me the usage:
Usage: useradd [options] LOGIN
useradd -D
useradd -D [options]
Options:
-b, --base-dir BASE_DIR base directory for the home directory of the
new account
-c, --comment COMMENT GECOS field of the new account
-d, --home-dir HOME_DIR home directory of the new account
-D, --defaults print or change default useradd configuration
-e, --expiredate EXPIRE_DATE expiration date of the new account
-f, --inactive INACTIVE password inactivity period of the new account
-g, --gid GROUP name or ID of the primary group of the new
account
-G, --groups GROUPS list of supplementary groups of the new
account
-h, --help display this help message and exit
-k, --skel SKEL_DIR use this alternative skeleton directory
-K, --key KEY=VALUE override /etc/login.defs defaults
-l, --no-log-init do not add the user to the lastlog and
faillog databases
-m, --create-home create the user's home directory
-M, --no-create-home do not create the user's home directory
-N, --no-user-group do not create a group with the same name as
the user
-o, --non-unique allow to create users with duplicate
(non-unique) UID
-p, --password PASSWORD encrypted password of the new account
-r, --system create a system account
-R, --root CHROOT_DIR directory to chroot into
-s, --shell SHELL login shell of the new account
-u, --uid UID user ID of the new account
-U, --user-group create a group with the same name as the user
-Z, --selinux-user SEUSER use a specific SEUSER for the SELinux user mapping
I gave the whereis nologin and it printed
nologin: /usr/sbin/nologin /usr/share/man/man5/nologin.5.gz /usr/share/man/man8/nologin.8.gz
When I tried with /usr/sbin/nologin it gives me the same output.
What do I miss? How to check if the user created?
useradd -g ftpgroup -s /sbin/nologin –d /dev/null ftpuser? You might need to usesudoas well as useradd typically needs root priviliges. – Phil B. Dec 31 '15 at 13:52/sbin/nologinand/etc/sbin/nologinbut I have the same problem. I checked with thecat /etc/passwd | grep ftpuserif the user created but it failed – trelozakinthinos Dec 31 '15 at 14:06sudo useradd -g ftpgroup -s /usr/sbin/nologin –d /dev/null ftpuserand
– trelozakinthinos Dec 31 '15 at 15:03sudo useradd -g ftpgroup -s /sbin/nologin –d /dev/null ftpuseruseradd jason. Theuseradd -D jasondidn't work neither. – trelozakinthinos Dec 31 '15 at 15:24useradd -DreturnsGROUP=100 HOME=/home INACTIVE=-1 EXPIRE= SHELL=/bin/bash SKEL=/etc/skel CREATE_MAIL_SPOOL=no– trelozakinthinos Dec 31 '15 at 15:38which useraddreturns/usr/sbin/useradd– trelozakinthinos Dec 31 '15 at 15:41groupadd ftpgroupreturnsgroupadd: group 'ftpgroup' already exists. Also I triedsudo adduser -g ftpgroup -s /usr/sbin/nologin –d /dev/null ftpuserand returns `Option g is ambiguous (gecos, gid, group) Option s is ambiguous (shell, system) adduser [--home DIR] [--shell SHELL] [--no-create-home] [--uid ID] [--firstuid ID] [--lastuid ID] [--gecos GECOS] [--ingroup GROUP | --gid ID] [--disabled-password] [--disabled-login] USER Add a normal useradduser --system [--home DIR] [--shell SHELL] [--no-create-home] [--uid ID] [--gecos GECOS] [--gro... `
– trelozakinthinos Dec 31 '15 at 16:10sudo adduser [--ingroup ftpgroup] [--shell /usr/sbin/nologin] [–-home /dev/null] ftpuser(without brackets as well) and it returnsadduser: Only one or two names allowed.– trelozakinthinos Dec 31 '15 at 16:47