Robert Citek
2016-08-24 01:01:23 UTC
On Ubuntu, I would like to force a user to set their own password. So
on account creation I would do this:
passwd --delete ${username}
chage -d 0 ${username}
Are there any security risks created by running those commands, in
particular, deleting the user's password?
As far as I can tell, a user cannot become any user or escalate their
privileges until they create a password. Here's a sample of commands
using user zfoo and zbar.
Create and configure zfoo and zbar users:
***@yoda:~# useradd -m zfoo
***@yoda:~# useradd -m zbar
***@yoda:~# passwd -d zbar
passwd: password expiry information changed.
***@yoda:~# grep z /etc/shadow
zfoo:!:17036:0:99999:7:::
zbar::17036:0:99999:7:::
***@yoda:~# grep %sudo /etc/sudoers
%sudo ALL=(ALL:ALL) ALL
***@yoda:~# usermod -aG sudo zbar
***@yoda:~# id zbar
uid=1005(zbar) gid=1005(zbar) groups=1005(zbar),27(sudo)
Become zfoo and try to become zbar:
***@yoda:~# su - zfoo
***@yoda:~$ su - zbar
Password:
su: Authentication failure
***@yoda:~$ exit
logout
Become zbar and try to become zbar:
***@yoda:~# su - zbar
***@yoda:~$ su - zbar
Password:
su: Authentication failure
Try to run sudo as zbar:
***@yoda:~$ sudo id
[sudo] password for zbar:
Sorry, try again.
[sudo] password for zbar:
Sorry, try again.
[sudo] password for zbar:
Sorry, try again.
sudo: 3 incorrect password attempts
Change password:
***@yoda:~$ passwd
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
***@yoda:~$ sudo id
[sudo] password for zbar:
uid=0(root) gid=0(root) groups=0(root)
This is actually a really nice feature as I do not need to send any
credentials to the user when I create their accounts. I only need
their public ssh key. Then it's just a matter of creating the
account, adding their public ssh key, deleting the password, and
setting the password to expired. When they ssh in using their keys,
they are forced to change their password, but they don't have to type
in an existing password as there is none.
That is, it's a nice feature as long as there are no security risks. Are there?
Regards,
- Robert
on account creation I would do this:
passwd --delete ${username}
chage -d 0 ${username}
Are there any security risks created by running those commands, in
particular, deleting the user's password?
As far as I can tell, a user cannot become any user or escalate their
privileges until they create a password. Here's a sample of commands
using user zfoo and zbar.
Create and configure zfoo and zbar users:
***@yoda:~# useradd -m zfoo
***@yoda:~# useradd -m zbar
***@yoda:~# passwd -d zbar
passwd: password expiry information changed.
***@yoda:~# grep z /etc/shadow
zfoo:!:17036:0:99999:7:::
zbar::17036:0:99999:7:::
***@yoda:~# grep %sudo /etc/sudoers
%sudo ALL=(ALL:ALL) ALL
***@yoda:~# usermod -aG sudo zbar
***@yoda:~# id zbar
uid=1005(zbar) gid=1005(zbar) groups=1005(zbar),27(sudo)
Become zfoo and try to become zbar:
***@yoda:~# su - zfoo
***@yoda:~$ su - zbar
Password:
su: Authentication failure
***@yoda:~$ exit
logout
Become zbar and try to become zbar:
***@yoda:~# su - zbar
***@yoda:~$ su - zbar
Password:
su: Authentication failure
Try to run sudo as zbar:
***@yoda:~$ sudo id
[sudo] password for zbar:
Sorry, try again.
[sudo] password for zbar:
Sorry, try again.
[sudo] password for zbar:
Sorry, try again.
sudo: 3 incorrect password attempts
Change password:
***@yoda:~$ passwd
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
***@yoda:~$ sudo id
[sudo] password for zbar:
uid=0(root) gid=0(root) groups=0(root)
This is actually a really nice feature as I do not need to send any
credentials to the user when I create their accounts. I only need
their public ssh key. Then it's just a matter of creating the
account, adding their public ssh key, deleting the password, and
setting the password to expired. When they ssh in using their keys,
they are forced to change their password, but they don't have to type
in an existing password as there is none.
That is, it's a nice feature as long as there are no security risks. Are there?
Regards,
- Robert
--
ubuntu-us-mi mailing list
ubuntu-us-***@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-us-mi
ubuntu-us-mi mailing list
ubuntu-us-***@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-us-mi