Hot answers tagged

64

Because $ is a special character to the shell you should put the password in between single quotes: useradd -p '$6$Ic2PVlwi$2nf.IRWTMy0FHrPza6mh5wjomwbYtIIxnzxPZL7yg8SsvOdbjEpoI0G8uy7AqduYKQOn2R/rnnaalRmfPMy.a0' bwong20 without these the shell will try to expand $6, $Ic2PVlwi and $2 to their respective variable values, and as the variables are not set, ...


4

As muru says, you should just use adduser: adduser myuser will prompt for myuser's GECOS information and password, and create myuser's home directory with the appropriate permissions. The default shell should be /bin/bash. adduser will also populate the new home directory with the contents of /etc/skel (default shell initialisation scripts etc.). All ...


3

First: you need to indent password: in your playbook, because you want it to be a variable: vars: password: hashed_password If it's not indented then Ansible considers it a play parameter and throws an error because password is not. Second: unless you are setting the password for a user on OSX, you need to provide a hashed value of a password. Follow ...


3

To change the location of Mailbox, include the below line in the file '/etc/postfix/main.cf' virtual_mailbox_base = /Location/Mail/ If you don't want to create home directory(i.e non Unix Account user) then include the below line in the file '/etc/postfix/main.cf' virtual_alias_maps = hash:/etc/postfix/userlist Once you added these files in Postfix, ...


3

This was answered many times, but I can't find it now. The answer is RTFM. Short story long: From man sshd_config you can get this line: ChrootDirectory Specifies the pathname of a directory to chroot(2) to after authentication. All components of the pathname must be root-owned directories that are not writable by any other user or group. After ...


3

The account will be setup without login possibilities as there is no valid password assigned to the account, and that is different from no password. You can check this by doing sudo grep -f system-user /etc/shadow. The second field (between the first and second colon (:)) will be a '*' and no hash of any password you can provide will match against that. ...


3

No. You just end up with users whose login group doesn't have a name.


3

Don't try making the login name longer, you'll probably find loads of places it breaks. Note that you don't have a problem with the number of possible login names (you only get UID_MAX-UID_MIN uids anyway, which is 59,000 on my system). The problem is just with how descriptive they are, but fortunately there's another field intended to be descriptive: the ...


3

Just call useradd and pass it the arguments you want. To create a system user, passs the -r option. If you don't want a home directory, pick something like /none and pass the -M option. If you want to be able to use su to run commands as that user, the user needs to have a valid shell. useradd -r -d /none -M -U -s /bin/sh I don't recommend modifying the ...


2

You should use option -m to create the home dir when doing useradd. -d ... is only to override the default name for the home dir, which is the same as the one you actually gave. You need to chown name:name /home/name for each name now to recover. -m is useful as it also copies some standard files into the home dir.


2

From your overall description you are missing one step. What you have is: Create RBAC profile /etc/security/prof_attr Create Command allowed for the profile /etc/security/exec_attr Create role account and assign the profile to it. roleadd -s /usr/bin/pfksh -P "Created Profile" roleA && passwd roleA Create the the user account and assign role to it. ...


2

You can give useradd the -r or --system flags to tell it you want such a user (a system user as you already called it). Here's an excerpt from my system's man page: -r, --system Create a system account. System users will be created with no aging information in /etc/shadow, and their numeric identifiers are choosen in the ...


2

First set a variable containing the username: myUSER=user1 Then call the adduser script using: sudo adduser --ingroup teacher "$myUSER"


2

Probably because you do not use the userdel command as superuser (root) or other privileged user. Try: sudo userdel accountname As stated in several comments it is also possible to remove the homedirectory configured while removing the useraccount using: sudo userdel -r accountname


2

As per man useradd, it creates SUB_UID_COUNT secondary uid range reserved for each user SUB_UID_MIN (number), SUB_UID_MAX (number), SUB_UID_COUNT (number) If /etc/subuid exists, the commands useradd and newusers (unless the user already have subordinate user IDs) allocate SUB_UID_COUNT unused user IDs from the range SUB_UID_MIN to SUB_UID_MAX for each new ...


2

Most programs that need to care about usernames will do a getent() lookup to find the UID and use that from then on - that's because users are identified by the uid, the number. The name is not much more than pretty-printing and convenience. For example, run id 1000 or getent passwd 1000 and they will only display the first entry for that uid. It is not ...


2

The easiest way is to set the mail_spool_directory to the new directory: sudo postconf mail_spool_directory=/Location/Mail/ For this to work, home_mailbox must be empty: sudo postconf home_mailbox= However, your server might be set up to use a different command to write deliver mails to a user. The mailbox_command parameter might have been set (e.g. ...


2

You can to do it using passwd's -e option after creating the account. useradd has -e option for expiring a user account, not password. From man passwd: -e, --expire Immediately expire an account's password. This in effect can force a user to change his/her password at the user's next login.


2

As suggested, this is fairly easy to accomplish. On the terminal you could use a for loop like this: for i in {20001..20100}; do useradd -u $i -g 1000 -d /home/app/mnt/$i "user${i}"; done The loop is incremented up to 20100 and then it quits.


1

The -M flag for useradd means "do not create the user's home directory", so the program has done what you asked. You can fix the problem by creating a home directory for Alice and copying in the template files: home=$(getent passwd Alice | cut -d: -f6) uid=$(getent passwd Alice | cut -d: -f3) gid=$(getent passwd Alice | cut -d: -f4) mkdir -m755 "$home" cp -...


1

As thrig pointed out, all that's needed is to create the directory structure that you want under /etc/skel. Quoting from the useradd man page -k, --skel SKEL_DIR The skeleton directory, which contains files and directories to be copied in the user's home directory, when the home directory is created by useradd. This option is only valid if the -m ...


1

Assuming usernames are one per line or separated by one or more spaces, in the listfile, you can use this : for user in $(cat listfile) do useradd -m -d /home/top100/${user} ${user} done


1

You can create something like /var/empty and use it for your all system users, or just specify something like /dev/null as their home directory. I use the latter for system users that just run one binary (often service). If program wants to store something, I specify /srv/app where app is program name and make the directory for it. If programs like useradd ...


1

Run useradd with the -N, this argument is used that tells the system to only create username (without group).


1

For me , by default, the /etc/skel contains just 3 hidden files, .bash_logout , .bashrc and .profile, which can be displayed with ls -a. Your command should work, have you checked the content of your /etc/skel directory ?


1

It sounds like you want to change the owner and right of the file. To change owner to root write $ sudo chown root server.properties. This will let you set different premissions for the owner than others. To change the file premissions you'll have to use chmod. You can read more about it here, but you shuold set write and read access to the owner (root) ...


1

OK, I solved it: the problem was I did $ chown user:user /var/www/xxxxxx.com/public_html/directory/ What I had to do is $chown root:root /var/www/xxxxxx.com/public_html/directory/ Then, inside "directory" I made a directory for the user with 777 permission (is not the better way but it works) The "rejected by peer" error is because /directory must ...


1

You add the users the same way as the normal ones. Just make their shell path /sbin/nologin and you're okay. Read up on the useradd manual for more info: $ man useradd


1

You should first initialize the passwd of your user : $passwd system-user then return two times in order to create a blank passwd. You can verify that there's no passwd in the file /etc/shadows (the second field should be empty). But yes, this account will not be protected even with no $HOME neither shell. All users with a sudo account will be able to ...


1

The list of groups a user belongs to is stored in /etc/group When you add a user to group /etc/group is updated. The /etc/passwd file doesn't tell you which users belong to which groups. It only has the group id of the user's default group. The groups command returns info from /etc/group



Only top voted, non community-wiki answers of a minimum length are eligible