Tag Info

Hot answers tagged

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

useradd only uses the same UID and GID when either: It won't cause a conflict; or You force it with the -u and -g flags It will skip over already-in-use IDs. So, I would guess that you have added other users and/or groups since you created those that have matching UID/GID pairs.ยน To get the IDs back in lock-step, you could create the next one with -g ...


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


4

adduser is there for compatibility with older versions of RHEL, and with other OSes. For purely command-line operation, useradd is the preferred method. system-config-users doesn't fit in the same category as the other two. It is a GUI program. It's implemented in terms of userhelper, which has a command line I/O interface more suitable for use as the ...


3

Usually just the name of the package or program, so hadoop in this case. Daemons are usually added as a system account using useradd -r, which gives them a userid lower than human users (on my system, system accounts start at 100, human users start at 1000). Looking at the user names for system accounts in /etc/passwd seems to confirm the lack of any ...


3

Just call useradd and pass it the arguments you want. To create a system user, passs the -r option. If you don't want a home directory, pick something like /none and pass the -M option. If you want to be able to use su to run commands as that user, the user needs to have a valid shell. useradd -r -d /none -M -U -s /bin/sh I don't recommend modifying the ...


3

Start with creating a user: useradd -m -d /home/username -s /bin/bash username Create a key pair from the client which you will use to ssh from: ssh-keygen -t dsa Copy the public key /home/username/.ssh/id_dsa.pub onto the RedHat host into /home/username/.ssh/authorized_keys Set correct permissions on the files on the RedHat host: chown -R ...


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

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


2

useradd -m LOGIN creates the user's home directory


1

The list of groups a user belongs to is stored in /etc/group When you add a user to group /etc/group is updated. The /etc/passwd file doesn't tell you which users belong to which groups. It only has the group id of the user's default group. The groups command returns info from /etc/group


1

There are as many opinions as there are people. I think the best way to create tomcat user to do as follows: # useradd -r -s /sbin/nologin tomcat # chown -R tomcat: /usr/local/tomcat It means, you will create system account. Info from man useradd: System users will be created with no aging information in /etc/shadow, and their numeric identifiers are ...


1

The useradd program has been deprecated in favor of adduser. From man useradd: useradd is a low level utility for adding users. On Debian, administrators should usually use adduser(8) instead. adduser is a friendlier frontend to useradd and will do things like create user directories by default. When you run it with only a username as an argument, ...


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

You could use: usermod --lock <username> From the man page: Lock a user's password. This puts a '!' in front of the encrypted password, effectively disabling the password. You can't use this option with -p or -U. Note: if you wish to lock the account (not only access with a password), you should also set the EXPIRE_DATE to 1.


1

Make sure your user and root have passwords; as root, run: passwd user passwd (replacing user as appropriate). Once you've done that, you can replace console::respawn:/bin/sh -l which starts a shell directly, with console::respawn:/bin/login if you have /bin/login on your system. Traditionally you'd use getty to manage the serial connection ...


1

You can use useradd and chpasswd to automate user creation. e.g. useradd -c "Bob Smith" -m bob echo "bob:mypassword" | chpasswd If you don't want the plain text password to appear in the script, use the --encrypted flag echo "bob:encrypted_mypassword" | chpasswd --encrypted


1

Depending on what files you want, you can create a new group (/etc/group) and make the file writable (and the directory containing it if you want the user to create new files) by that group (e.g., chgrp <groupname> <file>; chmod g+w <file>


1

Letting adduser choose a user ID is the right way to do it. This won't conflict with official packages because automatically-assigned UIDs and statically-assigned UIDs are in different ranges. Yes, this does lead to different user IDs across systems; there's no easy way to do that because you'd have to tell the whole world (every system administrator and ...


1

The RHEL6 migration guide documents that there's a list for statically-assigned UIDs in /usr/share/doc/setup-*/uidgid, which currently goes up to roughly 200, and dynamic system users count downwards from 499. I read that as "use adduser -r in this case and certainly don't worry if you stay above 300; you won't collide unless you have hundreds of system ...


1

What you want is a custom pam solution. Pluggable Authentication Modules are capable of doing things like this with minimal difficulty. The challenge is to manage the users. The two ways to accomplish this depends on where you are keeping your main user database. If you are using LDAP, the ldap modules have options to restrict users based on various ...


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

As @Mikel suggests, if you are trying to configure a system account which is a daemon, try configuring the daemon itself. I came to this question looking how to set the umask for the _www account on MacOS. While this is difficult as the answers above suggest, I found I could solve it by configuring the apache service as (in this case) the user == a daemon. ...


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

Look at the first line in /etc/shadow: it seems that one field is missing


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



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