0

I am using Ubuntu 19.10.I want add a system user with a home directory, and the user won't have any login access or password. I want to accomplish this by running useradd without sudo command.

I gave following permission to the main user using sudo visudo:

main_user ALL=(root) NOPASSWD: \
    /usr/sbin/useradd, /usr/bin/chmod, /usr/sbin/userdel, /usr/bin/setfacl, /usr/sbin/usermod

I have followed answer Creating a user without a password but seems like there is no --disabled-password parameter in useradd. Even there was, would it prevent useradd: cannot lock /etc/passwd; try again later. error, since I believe it won't access into the passwd file.

useradd -d /var/users/general -m general --shell /bin/bash

error:

useradd: Permission denied.
useradd: cannot lock /etc/passwd; try again later.
alper
  • 224

0 Answers0