Creating an user without a password [closed] - linux

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I'm trying to create user without password like this:
sudo adduser \
--system \
--shell /bin/bash \
--gecos ‘User for managing of git version control’ \
--group \
--disabled-password \
--home /home/git \
git
It's created fine. But when I try to login under the git user I'm getting the password entering:
su git
Password:...
When I leave it empty I get an error:
su: Authentication failed
What's wrong?

"Disabled-password" doesn't disable authentication; it allows for non-password means of authenticating. Your "su" command isn't using any of those, so it prompts for a password. There won't be any that match the hashed string.
As a privileged user, you can delete the hashed password string and enable logins without any authentication (bad idea for this account). Better is to either set up sudo or ssh to allow a specific list of users to assume this identity.

Related

Could not chdir to home directory after create a user [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 4 years ago.
Improve this question
I've created a user in Ubuntu 16.04 using the commands
sudo useradd peris
sudo passwd peris
Then I log off, ans log in with the new user but I got this error:
Could not chdir to home directory /home/peris: No such file or directory
To automatically create the user's home directory you have to call:
sudo useradd -m peris
From now on, the best you can do is manually create the user's home directory using:
sudo mkdir /home/peris
And set the user's home directory so the system actually knows where to go. This can be done using:
sudo usermod -d /home/peris peris
Also, you want to make sure the said user has rights on his own folder. Use:
sudo chown peris:peris /home/peris

How to create user in linux by providing uid and gid options? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
The community reviewed whether to reopen this question 12 months ago and left it closed:
Original close reason(s) were not resolved
Improve this question
I have 2 linux machines. On one machine these are the users:
sysadmin2:x:4201:4200::/home/sysadmin2:/bin/bash
appadmin1:x:4100:4100::/home/appadmin1:/bin/bash
appadmin2:x:4101:4100::/home/appadmin2:/bin/bash
dataadmin1:x:4300:4300::/home/dataadmin1:/bin/bash
dataadmin2:x:4301:4300::/home/dataadmin2:/bin/bash
sysadmin1:x:4200:4200::/home/sysadmin1:/bin/bash
I want to replicate these to another machine. How can I create these users with same uid and gid values? Is there a way I can copy them to another machine?
First, create the group if it doesn't exist:
$ groupadd -g 4200 sysadmin2
Next, create the user and add it to the group:
$ useradd sysadmin2 -u 4201 -g 4200 -m -s /bin/bash
$ useradd appadmin1 -u 4100 -g 4100 -m -s /bin/bash
and don't forget to reset password for each user.
In summary and in general, you can use the useradd command to add users to a linux system. The -u flag allows you to set a specific user id and the -g flag allows you to set a specific group id. Please see useradd's manpage for more details -- on a terminal, type man useradd to see it.
Now, specifically about your problem, see below.
Assumming you have three groups on your original machine:
$ cat /etc/group
...
appadmins:x:4100:
sysadmins:x:4200:
dataadmins:x:4300:
...
On your destination/new machine, you should first create the groups using:
groupadd appadmins -g4100
groupadd sysadmins -g4200
groupadd dataadmins -g4300
Then, you can proceed to create the actual users like so:
useradd appadmin1 -u4100 -g4100 -d/home/appadmin1 -s/bin/bash
useradd appadmin2 -u4101 -g4100 -d/home/appadmin1 -s/bin/bash
useradd sysadmin1 -u4200 -g4200 -d/home/sysadmin1 -s/bin/bash
useradd sysadmin2 -u4201 -g4200 -d/home/sysadmin2 -s/bin/bash
useradd dataadmin1 -u4300 -g4300 -d/home/dataadmin1 -s/bin/bash
useradd dataadmin2 -u4301 -g4300 -d/home/dataadmin2 -s/bin/bash
The -d option is used to set the home directory and the -s option is used to set the shell. Again, -u and -g are used to set a specific user and group id.
To check that everything went correctly, just use grep admin on your /etc/passwd file:
$ grep admin /etc/passwd
appadmin1:x:4100:4100::/home/appadmin1:/bin/bash
appadmin2:x:4101:4100::/home/appadmin1:/bin/bash
sysadmin1:x:4200:4200::/home/sysadmin1:/bin/bash
sysadmin2:x:4201:4200::/home/sysadmin2:/bin/bash
dataadmin1:x:4300:4300::/home/dataadmin1:/bin/bash
dataadmin2:x:4301:4300::/home/dataadmin2:/bin/bash
If something is wrong, you can use userdel or groupdel accordingly and start over.
The account configure files could be shared by any Linux machine in same privileges. you could make a copy to that machine to have a same user list by this command:
scp /etc/{passwd,shadow} root#your_marchine_IP_address:/etc/ -p

Trying to change a Linux password without using passwd [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I'm a linux noob and I'm stuck on a small detail of a class assignment.
I meant to do this from a root shell:
useradd myname -g sudo -p 'openssl passwd -crypt abc123'
To create a sudoer account for me.
Messed it up the first time, so now it says the user already exists.
I want to make sure I'm in the sudoers group and that I know my password to SSH in.
The passwd command can't be used, nor the adduser command.
I know the useradd command is available, but not sure if I can use that somehow...
Ideas?
Edit: And how could I double-check that it worked?
Edit2: I don't have access to an editor like nano or vim :/
Why not just examine (or edit, given the required powers) the /etc/passwd, /etc/shadow, /etc/group and /etc/sudoers files?
Just about everything to do with standard security can be found there
To double check if it works, simply log in from another terminal and try.
Found a work-around:
userdel myname
useradd -m -g sudo -p `openssl passwd -1 abc123` myname
For some reason, I'm able to use sudo but am not in /etc/sudoers
#paxdiablo, thank you for the help!

Can't set password for newly added linux user [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I used this cmd to add a new user and a new group.
# groupadd lfs
# useradd -s /bin/bash -g lfs -m -k /dev/null lfs
# su lfs
$ passwd
Changing password for lfs.
(current) UNIX password:
Then no matter what password I typed (my root passwd, or a completely new one), they all failed.
$ passwd
Changing password for lfs.
(current) UNIX password:
passwd: Authentication token manipulation error
passwd: password unchanged
What's wrong with my setting ? How can I set the passwd successfully ? Thanks !
Become root and then change the password. It won't ask for current password.
su
passwd lfs

How do I add a user in Ubuntu? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
Specifically, what commands do I run from the terminal?
Without a home directory
sudo useradd myuser
With home directory
sudo useradd -m myuser
Then set the password
sudo passwd myuser
Then set the shell
sudo usermod -s /bin/bash myuser
Here's the command I almost always use (adding user kevin):
useradd -d /home/kevin -s /bin/bash -m kevin
There's basicly 2 commands to do this...
useradd
adduser (which is a frendlier front end to useradd)
You have to run them has root.
Just read their manuals to find out how to use them.

Resources