Hot answers tagged useradd
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
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
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.
5
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 ...
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
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
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 ...
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
3
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 ...
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
The command useradd needs some special privilege to modify the system settings. Hence, you get a permission denied when using it as a normal user.
To be able to call useradd from a normal user, you need to configure sudo. It is not too complicated, see this tutorial: http://quaid.fedorapeople.org/sudo-tutorial/ especially chapter 4.
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
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: ...
3
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 ...
2
You should read the manual: man sudo (Also here), and I'm not sure what the rules are but on most unix systems sudo is only allowed by users in the wheel group. So you should either make a rule for this new user that requires the password, or you add the user to the wheel group. (Use usermod -a -G wheel bruno)
2
System users differ from ‘normal’ ones in three ways: password expiry, home directory (system users don't have one), and UID (system users are usually below some arbitrary threshold).
In the general case, you're almost entirely out of luck. You can use PAM to set the umask, but PAM selects behaviours based on things other than these three differences.
In ...
2
The FreeBSD Handbook is an excellent source of information about FreeBSD. The Modifying Accounts section has explicit instructions for adding and removing users.
2
Basically you don't add, you change home directory.
usermod -d /home/ftp/root root
if you want to move existing files, use this:
usermod -d /home/ftp/root -m root
Allowing root to access via FTP it not good practice, it's security hole.
Even if this, I would rather recommend to create symlink to target folder from existing directory.
2
Set ADD_EXTRA_GROUPS and EXTRA_GROUPS in /etc/adduser.conf. From the manpage:
ADD_EXTRA_GROUPS
Setting this to something other than 0 (the default) will cause
adduser to add newly created non-system users to the list of
groups defined by EXTRA_GROUPS (below).
EXTRA_GROUPS
This is the list of groups that ...
2
Do all of your users have a single group in common? For example, on some systems the staff group is provided for use as the global group. If you create your users' home directories so they belong to this global group, just setting the read permission on them will allow all members of the group (i.e. everyone) to see other people's files. Note, though, that a ...
1
useradd should work (I've done it on Ubuntu). Maybe check that each of your args are correct (thee groups exist, the path is right to bash). You can run the command with just a password and user, and then use userdel to remove and then retry with more parameters, to see what one causes the issue (brute force approach).
There is also newusers (see the man ...
1
You can use OpenSSL to generate the random password (16 characters, in this case):
# 1000 bytes should be enough to give us 16 alphanumeric ones
p=$(openssl rand 1000 | strings | grep -io [[:alnum:]] | head -n 16 | tr -d '\n')
Then feed the hashed password to useradd or usermod
# omit the "-1" if you want traditional crypt()
usermod -p $(openssl passwd ...
1
I was halfway through D_Bye's answer when I realised I could do it another way that doesn't require playing around with mounting and /etc/fstab:
I created an account with its home catalog set to /home and set Pure-FTPd to enclose every user to his home catalog (ChrootEveryone YES).
This means that this account may browse every catalog in /home but doesn't ...
1
With CentOS 6 nscd might be running. If you did not change the group ownership by a hig-level-command (like usermod) you have to make sure to run grpconv so /etc/gshadow gets updated as well. If nscd is running add nscd -i group to invalidate the local group cache. If you changed the primary GID run nscd -i passwd.
Check the result with id -a $ACCOUNT.
...
1
Most unix systems have a 002 umask, i.e. only the user can write files by default.
Having a 022 umask can be useful on systems where each user is in their own primary groups. However, this umask is fraught with dangers. It leads to a lot of support problems with .ssh directories that are group-writable and hence ignored by the SSH daemon. It leads to ...
1
One difference between e.g. RHEL and (open)SuSE is that RHEL follows the User Private Group scheme in which the primary group of each user is a private group with the same name as the username.
(open)SuSE sets the private group of all users to "users" if I'm not mistaken.
Naturally a umask that allows members of a user's group to read all files is not ...
1
No. Generally speaking, the unix permission model only has two levels: root, and the rest. Root can do everything, and non-root users each have their own domain. Non-root users cannot create subdomains inside their security domain.
There is a way to create security domains as an ordinary user: run a virtual machine of some kind (VirtualBox, User Mode Linux, ...
1
It's an old question, but curious others can consider the command 'newusers'. This is present on both on 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 ...
1
If you're feeling adventurous, you can edit /etc/group directly and put in whatever group name you like. Also, this has the added bonus that when you encounter one of the problems @Gilles mentioned, you may not be able to load an editor to fix the problem, or even log in at all - giving you valuable experience in recovering a broken system!
Only top voted, non community-wiki answers of a minimum length are eligible