Questions tagged [useradd]
The `useradd` command is used to create new users on a system.
240 questions
2
votes
1
answer
90
views
How to do the same as 'useradd -l' for an existing user?
As far as I understand https://unix.stackexchange.com/a/84960/771338, useradd --no-log-init modifies the lastlog file to prevent a user from appearing in lastlog.
I have two questions about this:
Is ...
0
votes
2
answers
158
views
Can't add user to the group properly
Need to create user www-data in group ubuntu to make NGINX to serve a website.
/etc/passwd file:
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
ubuntu:x:1000:1000:ubuntu:/home/ubuntu:/bin/bash
...
9
votes
1
answer
1k
views
adduser allows weak password - how to prevent?
I want to enforce my password policy to both new users and existing ones, but when I run adduser on Ubuntu 24, it allows me to add a weak password.
$ sudo adduser handsm
[sudo] password for superuser: ...
0
votes
0
answers
53
views
How to adduser in a mounted partition without chrooting?
I would like to add a user in an SD image with an ARM Linux. Since my host computer is x86, I cannot just chroot into the mounted image. Is there a way to add a user to a filesystem at a relative path,...
0
votes
2
answers
73
views
When to useradd
I'm writing a daemon in C which needs to do some things as a separate user from root. I will call this user "testuser". My program is installed by its makefile. My question is thus, when ...
0
votes
1
answer
131
views
Adding an account via SSH not working with openssl
I am trying to add a user account to my remote server (running on Ubuntu 22.04) via SSH using below script:
#!/bin/bash
protect="y"
ssh -i ssh_key [email protected] <<END
sudo deluser ...
0
votes
2
answers
78
views
File Permission of a User with No Additional Groups
Using a Rocky Linux server, I created a user using the following command,
sudo adduser foobar
and user foobar is now a member of group foobar. We can confirm with the following.
foobar$ id
uid=1111(...
0
votes
2
answers
203
views
im new to linux and learning how to add a new user
I'm trying to create a user with first and last name and home directory in Users/username, with an expiration date, inactive, with a default UID and GID in the DKEL_dir /etc/skel2. This is what I ran ...
0
votes
0
answers
194
views
Restart systemd service when new user created
I need to restart a systemd service (running as root) every time a new user is created. I saw that some systems have a way to make an adduser hook but this isn't an option in RHEL8. What is the best (...
0
votes
0
answers
71
views
Is it possible for /etc/skel/.dotfile to have contents changed to match the username?
I want to create a ~/.nanorc file with a default backupdir path for each user:
set backup
set backupdir /var/nanobackup/username
Does this have to be customized after I create a new user or does /etc/...
1
vote
0
answers
90
views
Why doesn't openSUSE GUI allow one letter usernames during first install?
I burned the openSUSE Tumbleweed iso on USB and plugged it into a laptop to try it out. I ran the gui installer. When asked to choose a username I typed q in the username. However I was unable to ...
0
votes
1
answer
100
views
How does this script actually create the new user's directory structure
I'm looking at the bash script included below. It accepts a couple of command line arguments and creates a .deb package that, when executed, using the sudo dpkg -i created-file.deb command, a new ...
2
votes
1
answer
810
views
useradd --prefix option
If I'm not mistaken, the --prefix option of useradd should allow me to change the etc files from the directory I select, but it strangely adds an extra /.
I'm using Linux Mint 21.1 mate 64bit version ...
0
votes
0
answers
531
views
useradd --create-home not adding a home directory Rocky Linux 8 but does in CentOS 7
I have an RPM that runs a scriptlet to add a user and create a home directory.
I have used this before on CentOS 7, but now need this RPM to run it on Rocky Linux 8 so I've rebuilt the RPM (it's ...
0
votes
0
answers
803
views
Linux- How to set default values for future new users and create an empty file that is copied to each new users home directory?
In Linux on my Virtual Box, How do I set default values for any future new user? Also, how do I create an empty file named TESTFILE and have it copied to each new users home directory.
I believe I did ...
0
votes
1
answer
10k
views
How do you add a user using --gecos Linux Ubuntu?
I am trying to create a script that adds a user, but I have to do it in a non-interactive way without the default prompts of the adduser command. The instructions I have state that I should use --...
1
vote
1
answer
789
views
Create a system user without password and home directory on Centos machine
I want to create system user without password and home directory. I found some similar solution but not properly get my answer. I am using a centos machine.
in ubuntu: adduser mprobe --disabled-...
1
vote
2
answers
2k
views
useradd prompt user to change password at first login
what option should I add to my useradd command such that when the user logs in for the first time he's prompted to change the password or something?
I was thinking about this, but not sure if it's the ...
1
vote
1
answer
706
views
Im having useradd error in arch-linux
Im installing arch-linux for the first time and im following a video on youtube and im creating a non root user with the command
'' 'useradd -G wheel.audio.video - m nour11'''
But im getting the error
...
4
votes
1
answer
690
views
Put a specific file in every Unix user's home directory when they're created and added to a particular group
How can I set up my Solaris system so that every time a user is created and assigned to a specific group, a specific file is placed in that user's home directory?
1
vote
2
answers
2k
views
SystemD authentication makes me choose between the same user twice when using "systemctl start *service*"
I deleted and re-added my user, and now when I use systemctl start/stop service, it prompts me to choose to authenticate between two users, both being the same user.
How do I fix this?
This is what it ...
-1
votes
1
answer
296
views
How to get user creation details
Kindly assist to to get user creation details (date and time) and users login details in Solaris 10
0
votes
1
answer
249
views
Post-Useradd Script + Gnome Initial Login
I have a script at /etc/shadow-maint/useradd-post.d/ that takes a created username, gets their UID, adds one and prints :##=username to the end of /etc/tigervnc/vncserver.users, as well as writes a ...
0
votes
1
answer
1k
views
useradd -p option [duplicate]
I can't understand the purpose of -p option in 'useradd'
Let's create a user
useradd -m -p 'pass1' user1
after running the command above, when trying to log in using su - user1
authentication fails....
0
votes
1
answer
195
views
Cannot append user to group
I'm having trouble adding a user to a group:
# useradd -aG group user
# useradd -a -G group user
# useradd -G group user --append
It tells me that the -a option is an invalid or unrecognized.
Can ...
4
votes
1
answer
2k
views
Using "useradd" command correctly
On Ubuntu 20.04, I am trying to add a user, however, it keeps failing. I don't see anything wrong and going crazy over a simple useradd command! What am I doing wrong?
root@myhost:~# uname -a
Linux ...
0
votes
1
answer
507
views
How to create a new user and a txt file inside it?
I need to write a bash-script that will create a new user named user1 and an empty file
my_txt.txt in ~user1/tmp/ . The problem is terminal asks the password for new user and i don't know how to ...
1
vote
2
answers
16k
views
Change default login user for Linux from root
I've been working with Linux for awhile and was wondering how I could go about changing the default login user. The whole time I've used Ubuntu, I've been logging in as the root node, as bad as that ...
-1
votes
1
answer
990
views
useradd: group '9001' does not exist
i am trying to run the command:
root@minimanode:/# sudo wget -O minima_setup.sh https://raw.githubusercontent.com/minima-global/Minima/master/scripts/minima_setup.sh && chmod +x minima_setup....
2
votes
1
answer
3k
views
How to set maximum number of users in Linux?
For example, let's say that I want a maximum of 3 users.
How can I make sure that no more than 3 users can be created?
0
votes
1
answer
2k
views
debian (?) - create new user based off of an existing one (copying configs, apps, etc)
What I want to achieve:
Use an established user to create multiple new users each of which with identical starting set ups, same applications (e.g. Slack), same configurations (e.g. conda installed ...
3
votes
1
answer
4k
views
Creating a system user in Debian without home directory still creates a non-existent home directory entry in /etc/passwd
I'm trying to create a system user in Debian, with no home directory, for use with getmail.
Even though I did:
adduser --system --group --no-create-home getmail
The entry in /etc/passwd is:
getmail:x:...
1
vote
1
answer
2k
views
How to verify whether a user has a home directory or password?
Where can I find details on how a user was created. And what is the current status of a user.
For example, adduser command can be run with --no-create-home, --disabled-password, --home DIR etc.
Is ...
0
votes
1
answer
704
views
users command does not show recently added users
I have created few users:
sudo useradd bart
sudo useradd marge
sudo useradd lisa
sudo useradd maggie
These users now exist
$ awk -F: '{ print $1}' /etc/passwd
blueray
bart
marge
lisa
maggie
However ...
0
votes
1
answer
3k
views
Check if user exists in /etc/passwd, if they exist, create new one with prefix
Kinda stuck here, did not find any solution.
Check if user exists in /etc/passwd, if they exist, create new one with prefix new_the_existed_one
#!/bin/bash
myuser="/home/yakyak/Desktop/Exercises/...
1
vote
1
answer
8k
views
useradd create a user without password and accessible only by ssh
I'm writing a script that automatically creates a user using the useradd command (I need this one and not adduser).
I want to create it in a way that it is accessible only using ssh (the script ...
-3
votes
1
answer
405
views
Creating users with modified home directory and mask [closed]
I need to create 6 new users (one, two, three, four, five and six) with passwords, two of these (five and six) must have their personal directories modified (using skelo or configuration files, I don'...
0
votes
0
answers
286
views
useradd and user management in Plasma
I added a user in the terminal
useradd -m -g <groupID> -u <userID> <username>
Now, going to the user management of KDE I tried to change the name of the account (NOT the user name), ...
0
votes
0
answers
1k
views
openssl passwd password only works briefly
I am having a strange issue setting up linux VM instances. Please forgive me if this is basic, I am not a linux systems programmer (usually). I am trying to script the launching of 20+ linux ...
1
vote
2
answers
6k
views
How to avoid getting "sudo: Account or password is expired, reset your password and try again"
I am trying to add user e.g. amit to group amit,as below.
root# groupadd -g 1500 -f amit
root# useradd amit -m -G sudo -u 1500 -g 1500 -o -p "amit"
However, ...
0
votes
1
answer
212
views
How to add user in Unix System 7?
I have created a Unix System 7 VM in VirtualBox following instructions by Robert Nordier. I have dropped to the single user prompt (#). I can run commands like ls and passwd and cat. However, useradd ...
1
vote
2
answers
3k
views
Information of new user won´t show in terminal
I created a new user and logged in successfully on my ubuntu 20.04 machine.
When I logged in as root the terminal looks like this:
root@ubuntu-s-1vcpu-1gb-fra1-01:~#
When I login with my "...
0
votes
1
answer
152
views
Cross Distro way of creating a service user and group?
On Debian/Ubuntu systems I can use the following line to create a user and group named "dv" just for usage on a daemon service (systemd). No SSH login, no password, no home directory etc:
...
0
votes
1
answer
2k
views
How to add new Linux user restricted to ssh tunneling with password?
I wanted to create a new user on my linux server so that he can access my postgres database through an ssh tunnel. However, I want him to restrict his access only to the ssh tunnel.
I followed these ...
-8
votes
2
answers
76
views
How Does Unix Interpret $? [closed]
[orca@orcacomputers public_html]$ adduser Jé$$è+rèè
adduser: invalid user name 'Jé28956è+rèè'
I am unable to use $ when adding users in CentOS7. Karen goes "WHY THE HELL WOULD YOU DO THAT!?&...
1
vote
2
answers
2k
views
Prompt string not set properly in Bash for new user
I'm using Kali Linux for one of my classes, and part of our first assignment is to create a custom user account using our names instead of the default kali login, however when I do this it messes with ...
0
votes
0
answers
648
views
adduser: /etc/gshadow.: Structure needs cleaning
I am getting the following error when I try to add a new user
sh-4.2$ sudo adduser mbyousaf
adduser: /etc/gshadow.1341: Structure needs cleaning
adduser: cannot lock /etc/gshadow; try again later.
I ...
0
votes
1
answer
993
views
Cannot add user with useradd command
I am on CentOS 8.2 and I'm unable to add an user using the useradd command
[root@localhost ~]# useradd -m /home/alice -c "ALICE ADMIN" -s /usr/bin/bash alice
Usage: useradd [options] LOGIN
...
1
vote
1
answer
1k
views
Getting a warning I don't understand when trying to useradd with m & d options
I'm trying to add a new user, "abc", with a home directory of "/test/abc", for him, using the useradd command on an Ubuntu machine as follows:
useradd abc -md /test/abc
and ...
0
votes
0
answers
222
views
When creating new users, how can I incorporarte a sh script to be executed in order to create custom files/directores for the new users?
I want to run a script with sudo privileges when a new user is added to my system. More specifically, whenever I create a new user (with useradd or adduser), I want to be able to create a folder ...