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


11

Probably john's shell is not /bin/bash, but /bin/sh. On Ubuntu, that's a shell intended to execute scripts fast, with no fancy interactive features such as command line edition. Check last column of grep john /etc/passwd or getent passwd john. You might want to run chsh -s /bin/bash john to change user's shell.


9

See the source code, specifically libmisc/chkname.c. Shadow is pretty conservative: names must match the regexp [_a-z][-0-9_a-z]*\$? and may be at most GROUP_NAME_MAX_LENGTH characters long (configure option, default 16; user names can usually go up to 32 characters, subject to compile-time determination). Debian relaxes the check a lot. As of squeeze, ...


8

If you don't specify a password when running useradd (-p PASSWORD), it disables the password on that account; the only way to login to it is through some other authentication method (e.g. SSH keys), or by suing from root. Since passwords are disabled, you can't set a new one as a regular user. Root can change anyone's password without needing the current ...


8

Everything should be OK, since when you run this from a command-line, $* expanded to nothing (i.e. the useradd program received just -u 12345 joebloggs).


6

This is an illustration of the difference between authentication and authorization. Sudo is primarily a tool for authorization. Its job is to determine whether you are allowed to execute a command with elevated privileges, and if you are, to execute that command. An entry like bruno ALL = (ALL): ALL in the sudoers file allows the user bruno to execute ...


6

Use useradd on Linux, at least. Use crypt(3) to generate an encrypted password, and then do the following for each: useradd -m -g [group] -p [crypt output] [user] -m creates a home directory. -g sets the user's initial login group. -p sets the encrypted password, as returned by crypt(3) (you should note that this option may be unsuitable as the encrypted ...


6

Easiest way to do this from the command line is to use the passwd command with root privileges. passwd username From man 1 passwd NAME passwd - update user's authentication token SYNOPSIS passwd [-k] [-l] [-u [-f]] [-d] [-n mindays] [-x maxdays] [-w warndays] [-i inactivedays] [-S] [--stdin] [username] DESCRIPTION The passwd ...


6

According to the manual you should use adduser: man useradd DESCRIPTION useradd is a low level utility for adding users. On Debian, administrators should usually use adduser(8) instead.


6

Just use the command line parameters instead of stdin, and use chpasswd for the password. For example: sudo adduser myuser --gecos "First Last,RoomNumber,WorkPhone,HomePhone" --disabled-password echo "myuser:password" | sudo chpasswd


5

Does SuSE useradd have the -p option? That takes the password (albeit in encrypted form, but you should be able to generate that I think). So useradd -p <crypt'ed password> <new username> should do it I think


5

Editing the group, passwd, and shadow files directly is safe, but in order to do so you should use the vigr and vipw commands. When using vigr or vipw, locks are applied to the files in order to prevent concurrent editing which can lead to file corruption.


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


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

There are three normal ways to set a user's umask. Set UMASK in /etc/login.defs Add pam_umask.so to your PAM configuration in /etc/pam.d Set it in the shell startup files, e.g. /etc/profile There is no difference between system users and normal users in this regard. But I'm assuming you're trying to start a daemon with a custom umask? The problem is: ...


4

Your current login shell process keeps the group configuration it had before. Especially, compare the output of groups sachin with groups . After logout and login, the difference is gone. If you cannot relogin due to reasons unclear to me, you have to cascade the newgrp stuff. Imnternally, newgrp does nothing but "relogging in" in a new layer of ...


4

It's fairly simple. From the command line issue either sudo passwd USERNAME and you'll be prompted to change the users password. You may also su to the user in question and then run 'passwd' Useradd doesn't ask for password. adduser does.


4

You can use chpasswd to do it, like this: echo "username:newpassword" | chpasswd You can pipe into chpasswd from programs other than echo, if convenient, but this will do the trick. Edit: To generate the password within the shell script and then set it, you can do something like this: # Change username to the correct user: USR=username # This will ...


4

On Solaris /home is managed by the automounter by default. The simplest way if you don't need that functionality is to disable it. Just comment out the line that reads something like /home auto_home -nobrowse in the /etc/auto_master file and then restart autofs: svcadm restart autofs


4

You should create a new user as Hauke is right in indicating that creating two with the same UID is going to be confusing ( you could do that with useradd -u EXISTINGUID ... ) You probably just want to make a new user and make sure they are in the same group and that the group permissions are so that they can work with the data in the same group in the same ...


4

The problem is that the default shell for a new user on Debian is /bin/sh so most of the features you're used to from bash aren't there. Try adding -s /bin/bash to your useradd command. You can also change the default shell permanently by editing /etc/default/useradd. Edit: The solution to automatically modify the password (as found by MountainX) is here


4

-b specifies the location of users' home directories. On your average Debian box, this will be /home; you can change the default by editing /etc/default/useradd. useradd will add the new username to this path to get the home directory. This means that if you do useradd -b /somewhere ian the new user's directory will be /somewhere/ian. -d sets the home ...


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


3

Have you entered the password in encrypted form as returned by crypt like it is mentioned in the man page of useradd?


3

The process's groups are set by the program that changes from root to the target user before executing the process's program. When a user logs in, the program that changes the user is the login program (login, su, sshd, …) and the process's program is the user's shell. For a daemon run under system user, the program that changes the user can be su or some ...


3

Answering the question in your subject: OpenSuSE uses the traditional Unix umask setting, instead of the Debian-inspired one adopted by some other Linux distributions. Editing /etc/login.defs should be sufficient to change it; this will not affect users currently logged in, nor is there any way for you to force such a change to programs that are currently ...


3

You forgot a parameter: -m, --create-home create the dummy's home directory Are you sure you set the correct owner and permission to the directory? $ ls -ld /home dummy drwx------ dummy dummy ........... dummy $ chown dummy:dummy /home/dummy $ chmod 700 /home/dummy If you've already files in the directory, add an extra -R to both commands. ...


3

It's an old question, but curious others can consider the command 'newusers'. This is present on both a RHEL5.5 system and a Ubuntu 12.04 system that I use, so I'd take a guess it will available in the repositories for most distributions. From 'man newusers' The newusers command reads a file of user name and clear-text password pairs and uses this ...



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