Tag Info

Hot answers tagged

20

First off, the respective man page snippets highlight the differences between the two commands and give some indication of what is going on. For adduser: adduser and addgroup add users and groups to the system according to command line options and configuration information in /etc/adduser.conf. They are friendlier front ends to the low level ...


5

You have to give some options to useradd to create the directory. You can find those in the man page: -m, --create-home Create the user's home directory if it does not exist. The files and directories contained in the skeleton directory (which can be defined with the -k option) will be copied to the home directory. By default, ...


5

The explanation is not well documented. --disabled-login sets the password to ! Password values NP or null = The account has no password * = The account is deactivated & locked ! = The login is deactivated, user will be unable to login !! = The password has expired Examples root@gitlab:~# getent shadow vagrant ...


5

You can use chpasswd The chpasswd command administers users' passwords. The root user can supply or change users' passwords specified through standard input. Each line of input must be of the following format. username:password Only root users can set passwords with this command. Example 1: echo username:password | chpasswd Example 2: ...


4

It must have a home directory listed in /etc/passwd. Usually that will be whatever directory you store the web pages / config files in, though if you want to make sure it's a directory that doesn't exist, /nonexistent can be used instead. To create a user that is not allowed to login, you would do two things: give the user a shell that is not allowed to ...


4

When you're using /etc/passwd and /etc/shadow for user accounts (as set in /etc/nsswitch.conf and PAM), then entry in those two files are fully sufficient to create the account. (/etc/group may be needed too, for their groups). All useradd does is edit those files. If you edit them yourself with vipw & vigr and add the user, you've created the account. ...


2

The documented way to create the mysql account is: groupadd mysql useradd -r -g mysql mysql Add the -m option if you want that account to be used as a login account, which looks to be the case. If you have full sudo access, you can grant sudo rights to that use with using sudo visudo and adding a line similar the one starting with your username and ...


2

It's partially discussed here in the shadow man page. excerpt $ man shadow ... ... encrypted password Refer to crypt(3) for details on how this string is interpreted. If the password field contains some string that is not a valid result of crypt(3), for instance ! or *, the user will not be able to use a unix password to log in (but ...


1

It looks that that isn't an option here (Fedora 19, shadow-utils-4.1.5.1-5.fc19). It sounds like a very useful extension, though. Please report this as a request for enhancements in your distribution's bugtracker (or where that should go).


1

You can create the user with useradd and then schedule a usermod --lock command with at, e.g.: # echo usermod --lock juser | at now + 10 minutes Depending on your requirements you may want to verify what account invalidation procedure you need to execute via at. Note that disabling an account is not trivial. Even when deleting it - that does not ...


1

To add a new user with an expiration date, do: useradd -e 2014-02-03 foobar That will create a user called foobar who will only be valid until the 3d of February 2014. From man useradd: -e, --expiredate EXPIRE_DATE The date on which the user account will be disabled. The date is specified in the format YYYY-MM-DD. I don't think it is ...


1

useradd has largely been replaced by the newer adduser, as explained in man adduser: useradd is a low level utility for adding users. On Debian, administrators should usually use adduser(8) instead. So, instead of using useradd, use adduser that will create everything for you automatically: $ sudo adduser foo Adding user `foo' ... Adding new group ...


1

There are a number of ways to go about this, but I would write a small program or script that takes in the user info and runs adduser. The program would be owned by root, with the setuid bit set. Keep it as simple as possible. If you don't sanitize your input properly, you could have a security hole. Adding users to a system is dangerous business ...


1

If your only problem with sudo is having to use a password, you can add the NOPASSWD tag in your sudoers file. You want some_user ALL = (ALL) NOPASSWD:/path/to/adduser



Only top voted, non community-wiki answers of a minimum length are eligible