Questions tagged [useradd]

The `useradd` command is used to create new users on a system.

Filter by
Sorted by
Tagged with
70
votes
3answers
66k views

What does adduser do that useradd doesn't?

In addition to the more widespread useradd, Debian based systems also contain an additional adduser command which provides a higher level interface for adding users and some related tasks. There are ...
27
votes
3answers
50k views

Add a user without password but with SSH and public key

I want to add a user to Red Hat Linux that will not use a password for logging in, but instead use a public key for ssh. This would be on the command line.
24
votes
3answers
119k views

User without a password - how can one login into that account from a non-root account

I have just started to use Scientific Linux (7.0) (although I assume this question might be distribution neutral..). The kernel version is 3.10.0-123.20.1.el7.x86_64. Coming back to my question. I ...
23
votes
3answers
115k views

How do I set the password of a new user after the account has already been created?

I used the 'useradd' command to create a new account, but I did so without specifying the password. Now, when the user tries to log in, it asks him for a password. If I didn't set it up initially, ...
20
votes
1answer
1k views

Why is /etc/shadow shortening the password that I've set with the command: useradd -p?

[root@P-dude dude]# useradd -p $6$Ic2PVlwi$2nf.IRWTMy0FHrPzaCjkahfu9IIxnzxPZL7yg8SsvOdbjEpoI0G8uy7AqduYKQOn2R/rnnaalRmfPMy.a0 bwong20 [root@P-dude dude]# cat /etc/shadow | grep pswayze pswayze:nf....
19
votes
2answers
13k views

Bash is not fully functional for a new user

I just created a new user on my system using useradd -d /home/users/john -m john (Using Ubuntu 11.04). This worked fine, but when I changed to john, my bash is not fully functional. That is, it has no ...
16
votes
2answers
23k views

what does `adduser --disabled-login` do?

An install document I'm following instructs to add a user like so: sudo adduser --disabled-login --gecos 'GitLab' git The --disabled-login flag is absent from most man pages I have searched. I've ...
14
votes
3answers
31k views

How to set umask for a system-user?

Is it possible to set the umask for a system-user (created with useradd --system username)?
13
votes
3answers
52k views

Why is the home directory not created when I create a new user?

I created a new user (testuser) using the useradd command on an Ubuntu server Virtual machine. I would like to create a home directory for the user and also give them root provileges. However, when I ...
10
votes
2answers
18k views

What are the allowed group names for groupadd?

I followed these instructions to build Shadow, which provides the groupadd command. I am now getting an error when trying this: $ groupadd automake1.10 groupadd: 'automake1.10' is not a valid group ...
9
votes
2answers
46k views

How to add a unix/linux user in a bash script

Here's my test bash script. I'm not able to get it to work. I'm seeing two errors: Use of uninitialized value $answer in chop at /usr/sbin/adduser line 589. Use of uninitialized value $answer in ...
9
votes
4answers
18k views

How can I assign an initial/default password to a user in Linux?

I found a guide that explains how to set a user's password. I'm trying to automate it and send an e-mail to the user like: userid created with password XYZ. request to change the initial password. ...
9
votes
1answer
20k views

What steps to add a user to a system without using useradd/adduser?

I was browsing through some Linux questions and saw this interesting question. What steps to add a user to a system without using useradd/adduser? The one possible way that comes to my mind is, ...
9
votes
1answer
6k views

Implications creating System Accounts “useradd -r” Linux Fedora/RHEL/CentOS

I want to know what are the implications of create an account using -r option? # useradd -r ... The help says: -r, --system Create a system account. System users will be created with no aging ...
8
votes
2answers
8k views

is there any reason to avoid editing /etc/group directly

I find it much easier to edit files directly rather than remember commands like useradd -g, usermod, groupmod, etc. Is there anything wrong with just editing /etc/group directly?
7
votes
3answers
5k views

What is the difference between -g and -G options in useradd

After I look through the help. I didn't found much difference between them. -g, --gid GROUP The group name or number of the user's initial login group. The group name must exist. A group ...
7
votes
2answers
2k views

Should I use useradd or adduser?

I am trying to add a new user to the system. I am confused though which command to run: useradd or adduser?
7
votes
2answers
589 views

What is the use of option -o in the useradd command?

What is the use of option -o for command useradd? What is a good use case of this option?
7
votes
2answers
11k views

Why is sudo telling me my password is wrong?

I recently installed OpenBSD 4.9 in my computer, so I could learn a little bit about Unix-like operating systems. I added a new user to the system called bruno. Ok. When I use the 'sudo' command, it ...
6
votes
4answers
8k views

How should I add users non-interactively?

I have a set of users I need to add to a new system as part of a BASH script that preps my server. How can I non-interactively add the user, create their home directory, set the group, and enter a ...
6
votes
2answers
680 views

adduser has no difference from useradd

When I use the adduser command on fedora, it's not aksing for password or fullname. It's working exactly like useradd. I don't understand why. [hugues@localhost ~]$ sudo adduser user1 [hugues@...
6
votes
2answers
22k views

Proper way to add a user account via bash script

I cross posted this question to AskUbuntu because my problem seems most acute on Debian/Ubuntu, but it was suggested that I ask here. Whatever method is suggested for solving this problem should work ...
6
votes
2answers
2k views

Can not create SFTP user Debian 7

I have a linode and I access via ssh throw terminal. I need to create an sftp user which his default directory (and the only he can access) is /var/www/xxxxxx.com/public_html/directory Now, I did it, ...
6
votes
1answer
9k views

How to Create local user in LDAP enabled linux systems

During my application install, I used to create a new group and a new user using the 'groupadd' and 'useradd' commands groupadd my_group useradd -r -s /sbin/nologin -g my_group my_user But in one of ...
5
votes
3answers
1k views

Newly created user on Ubuntu Server has the wrong shell prompt

I've created a new user in the Ubuntu 18.04.01 like this: sudo useradd svn sudo passwd svn sudo mkhomedir_helper svn sudo usermod -d /home/svn -m svn Problem is, that if I switch to the user by su ...
5
votes
1answer
2k views

Not able to set password in ArchLinux

I logged in as root and created a new account: # useradd -d /home/onie -m onie # su onie Now I try to set the password for onie myself using the passwd command, but it's asking for my current ...
5
votes
3answers
44k views

How to create a user with given password on SuSE from command line?

I need to create bunch of new users with given password. What I want is a script that I would pass the user name of new user and it will create/add the user and set its password. (the password is the ...
5
votes
2answers
10k views

useradd: cannot create directory

A CentOS 7 server needs to have a new user created with a specific home directory and shell defined as follows, taken from the instructions at this link: sudo /usr/sbin/useradd --create-home --home-...
4
votes
4answers
10k views

Why is the default umask value for useradd in openSUSE set to 022?

I recently built a very simple test environment with openSUSE. As I tried to configure a shared directory, without using ACLs, but with SetGID on that directory instead for some reason, I noticed ...
4
votes
2answers
3k views

Default shell not being selected with useradd

I have a fresh version of Ubuntu 16.04.1 installed and have tried to create a new user account through root. I have changed the SHELL line in /etc/default/useradd to read as follows: SHELL=/bin/bash ...
4
votes
1answer
14k views

Can't add user because group already exists?

I initially added a user (adduser MYUSER) and then deleted it (deluser MYUSER). Now I'm trying to add it again (adduser MYUSER) and I get the following message: adduser: The group 'MYUSER' already ...
4
votes
2answers
23k views

Add user and set password using Ansible

I have created an Ansible playbook to create user and set password. But it is giving me an error ERROR: password is not a legal parameter of an Ansible Play --- - hosts: all user: root vars: ...
4
votes
1answer
36k views

How to set password for users in AIX using single line command?

Is there any way in which I can set the password for a newly created user account in AIX in a one line command? I don't want to give any prompt to the user. If there is a command, it should set the ...
4
votes
1answer
2k views

How to automatically create an empty directory when new user is created?

I'm trying to make it so when I create a new user either by using useradd or adduser, an empty directory named "whatever" is automatically created under that user's home directory. I've tried ...
4
votes
2answers
6k views

Adding “ubuntu” user to Vagrant ubuntu instance

I am using a vagrant box : uname -a Linux precise64 3.2.0-23-generic #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 2012 x86_64 x86_64 It does not have ubuntu user setup , instead it has vagrant one ,so I ...
4
votes
1answer
834 views

ArchLinux | Login password does not work after creating new user account

I am trying Arch Linux for learning more stuff faster and not having GUI that bothers me, so that I can focus on learning stuff from Linux itself and the terminal. Since I was working with the default ...
4
votes
2answers
5k views

Change user maildir to custom location upon creation of the user

I use Ubuntu 14.04.3 LTS . How to change the location of the Mailbox /home/user/Maildir/ to /Location/Mail/? I don't have to create home directory for that user. I did some changes in the /etc/...
4
votes
1answer
9k views

Using hashed password for adduser function in Linux

Sorry, I´m novice in Linux and I am looking for information, how to create new user account in Debian with pre-defined encrypted password. I have a function in bash, that if new user´s id´s are not ...
3
votes
1answer
501 views

Accidentally included special characters in username when adding user

I was trying to add a user called joebloggs and accidentally hit other keys as I pressed enter: useradd -u 12345 joebloggs$* (on French keyboards the $ and * keys are next to Enter) doing a cat of /...
3
votes
1answer
4k views

usermod to change user password is not working

I have created user using below command useradd myuser Then, I tried to do change password with following command usermod --password mypwd myuser (I know plain password is not a good way, but for ...
3
votes
1answer
987 views

Is there a common naming convention for daemon user accounts?

I'm from a windows background where I'm used to creating separate domain service accounts for running various services. I like to keep things need so I would name them DOMAIN\service.whatever I'm ...
3
votes
1answer
277 views

empty /etc/skel still adds default directories

I am using elementary freya and creating a new user with root# useradd -s /bin/bash -mk /etc/skel -d /home/secret -c otherme agentb24 and my /etc/skel is empty and I also want my new user home to be ...
3
votes
1answer
655 views

Reserving a range of anonymous UIDs; /etc/subuid

I need a range of uids (say a few thousand) for a setuid-root tool to use. Is there a protocol to registering such a range or do I just pick a range and hope no other program will use those uids? (I'...
3
votes
1answer
123 views

Creating new users via terminal does not assign correct permissions?

I am creating a new user for a Linux Debian distribution. I did use the command to create a new user via terminal, while I was logged in as root; tehn assigned the user to the sudo group, so I can ...
3
votes
2answers
2k views

Can I log in into a system user after I create him?

On an Ubuntu machine, if I run the following command: adduser --system --no-create-home system-user I create a system user named system-user without home directory with /bin/false as the shell. This ...
3
votes
1answer
2k views

difference between useradd -b and useradd -d

Can somebody please explain to me the exact differences between useradd -b and useradd -d in [Debian] Linux? Both seem to work quite similar to me, but then I spot differences that confuse me.
3
votes
2answers
10k views

Creating Group and User for Tomcat RHEL/CentOS

I want to create an user for my Tomcat installation, but I was viewing multiple options: # groupadd tomcat # # useradd -g tomcat -d /usr/local/tomcat tomcat # useradd -g tomcat -c "Tomcat User" -d /...
3
votes
1answer
26k views

Why useradd shows Permission denied error

I am working on CentOS 5.5. When I run the useradd command as root, then its working. But when I run the same command from one of the user, then it shows -bash: /usr/sbin/useradd: Permission ...
3
votes
3answers
373 views

When adding a user to a new group when does the user group permissions become active when its a /nologin user?

I have a service level account to run my webserver, and this user is setup with /sbin/nologin. Normally when you add a user to a group you must logout and login to use the new group permissions. ...
3
votes
5answers
10k views

Create new linux account as a user without root access

Is it possible to create a non-root Linux user account without being logged in as a root user and without using sudo?