Creating a user without a password
The --disabled-password
option will not set a password, meaning no password is legal, but login is still possible (for example with SSH RSA keys).
To create an user without a password, use passwd -d $username
after the user is created to make the password empty. Note not all systems allow users with empty password to log in.
You've created a user with a “disabled password”, meaning that there is no password that will let you log in as this used. This is different from creating a user that anyone can log in as without supplying a password, which is achieved by specifying an empty password and is very rarely useful.
In order to execute commands as such “system” users who don't log in normally, you need to hop via the root account:
su -c 'su git -c "git init"'
or
sudo -u git git init
If you want certain users to be able to run commands as the git
user without letting them run commands as root, set up sudo (run visudo
as root and add a line like %gitters ALL = (git) ALL
).
If you want to access the system under the git user you should use sudo:
sudo -s -u git
or
sudo su - git