Create an user with empty password
sudo useradd test-user-0
echo test-user-0:U6aMy0wojraho | sudo chpasswd -e
su test-user-0
The password prompt still shows unfortunately.
But if you just hit enter without typing anything, and it logins as the user test-user-0
.
The -e
flags tells chpasswd
that the password is already encrypted, and U6aMy0wojraho
is the hash of the empty string.
Tested on Ubuntu 18.04.
Terminal autologin with getty -a
On the terminal at least, you don't need to create an user without a password to allow someone to not type their passwords every time.
I was able to do this on BusyBox by modifying inittab
: How to login automatically without typing the root username or password in Buildroot BusyBox init?
So I believe that it should not be very hard to adapt that technique by modifying Ubuntu 18.04's systemd init system scripts to setup a getty -a <user>
terminal as mentioned in that answer, although I haven't tried to do it myself.
su git
as root where you don't have to provide a password. – scai Nov 26 '12 at 13:46chmod
andchown
. – scai Nov 26 '12 at 13:52sudo grep git /etc/shadow
? – Karlson Nov 26 '12 at 14:45If you set the shell to /usr/bin/git-shell you can limit their account to using git and nothing else. (You should also limit SFTP access but that can only be done from /etc/sshd_config).
Now, once you changed the shell, "su" won't work as-is. You'll have to do "su -s /bin/sh git" instead.
– MarioVilas Mar 03 '20 at 16:17/home
, but/var/lib
,/etc
or similar (or even no home). They are meant for automated services, not actual (human) users. Why bother with--system
if you're changing all defaults to the values meant for human users? – MestreLion Aug 24 '23 at 05:02