Tag Info

Hot answers tagged

22

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

The possible way to add an user is more or less similar to what I had put in the question. I got this approach from here. To create a new account manually, follow these steps: Edit /etc/passwd with vipw and add a new line for the new account. Be careful with the syntax. Do not edit directly with an editor. vipw locks the file, so that other commands won't ...


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, ...


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. ...


4

In my opinion, you need to recommend to your client to change their policy. As Ulrich Schwarz said in a comment, it's kind of surprising that all-numeric usernames work at all. Consider this: if a user called 12345 exists in the system, how would you use the chown command to change a file's uid to the numeric value 12345? Hint: it's actually possible, but ...


3

The umask 022 (or 0022) is the commonly used umask for UNIX systems which use the traditional style of user account management. In the traditional style of account management, when a user is created, the user is given a default group which would be something like a team or department, or maybe as simple as "users". setgid directories (we could call them ...


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 looks like your shell is not being bash but plain sh. Super quick solution: just execute bash and see if that helps. For a better and permanent solution please check /etc/passwd and see what shell does the user have there. If you find /bin/sh change it for /bin/bash


1

The problem is indeed what @LuisAntolin pointed out. On Ubuntu systems, and most others, the default shell is /bin/sh. This is a symlink to /bin/dash on Debian-based systems. dash has no history command which is why you're getting that error. While you can indeed change this by editing /etc/password, a better way is to run chsh as the user ubuntu and set ...


1

I don't know what you mean by "next available" with respect to the $HOME and $SHELL variables. Those you just set to their defaults: /home/USERNAME and /bin/bash or whatever. For the $HOME, just make sure the directory does not exist ([ -e "/home/$username" ] && echo "Directory exists"). As for the groups, just list the available groups and take ...


1

If you delete the user account, then the user no longer exists. It's perfectly normal that the user ID then gets reused: there is nothing to distinguish this user ID from any other unused user ID. If the account still owns files, the account still exists, so you need to keep it around. Don't delete the entry in the user database, mark it as disabled. On ...


1

You can use awk to filter out new users from /var/log/secure as follows:- awk '/new\ user/ {gsub(/,|name=/,"",$8); print $1, $2, $3, $8}' /var/log/secure Note: Debian systems (I believe) use /var/log/auth.log instead.


1

After adding new user if you are loggedin as a 'root' then you can set the password using command passwd <username> Or, if you are not root, you can run sudo passwd <username> To set the password. Or if you are root then you can 'su' to the user and run 'passwd' to set the password. su <username> passwd


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 ...



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