Hot answers tagged

31

There is a utility which will lookup user information regardless of whether that information is stored in local files such as /etc/passwd or in LDAP or some other method. It's called getent. In order to get user information out of it, you run getent passwd $USER. You'll get a line back that looks like: [jenny@sameen ~]$ getent passwd jenny ...


21

I don't have an OSX system handy to check on but on all *nixes, ~foo is a shorthand for the home directory of user foo. For example, this command will move into my user's $HOME (cd ~ alone will move into your home directory): cd ~terdon So, ~ and Tab will expand to all possible user names. The list should be the same as the list of users in /etc/passwd. ...


19

You have to check man passwd: If the encrypted password is set to an asterisk (*), the user will be unable to login using login(1), but may still login using rlogin(1), run existing processes and initiate new ones through rsh(1), cron(8), at(1), or mail filters, etc. Trying to lock an account by simply changing the ...


19

This is a security risk because file ownership in the FS is stored not by symbolic name, but by UID and GID. If a user is removed and files remain owned by that user, they become inaccessible under owner permission. However, if a different user is later created that is allocated the same UID, that user will gain ownership of the files. This is potentially a ...


16

User accounts are used not only for actual, human users, but also to run system services and sometimes as owners of system files. This is done because the separation between human users' resources (processes, files, etc.) and the separation between system services' resources requires the same mechanisms under the hood. The programs that you run normally run ...


16

TL;DR find / ! -type l -print0 | sudo -u "$user" perl -Mfiletest=access -l -0ne 'print if -w' You need to ask the system if the user has write permission. The only reliable way is to switch the effective uid, effective gid and supplementation gids to that of the user and use the access(W_OK) system call (even that has some limitations on some ...


13

usq psql shell and : \deu[+] [PATTERN] such as : postgres=# \deu+ List of user mappings Server | User name | FDW Options --------+-----------+------------- (0 rows) And for all users: postgres=# \du List of roles Role name | Attributes | Member of ...


13

The accounts with passwords are the accounts with a glob of base64 gibberish in the second field: root:8sh9JBUR0VYeQ:0:0:Super-User,,,,,,,:/:/bin/ksh lp:VvHUV8idZH1uM:9:9:Print Spooler Owner:/var/spool/lp:/bin/sh This computer appears to be using the traditional, DES-based crypt(3) password hash. This hash is quite weak by modern standards; if you can't ...


13

The following should work: sudo useradd -m -k /home/user1/ user2 where -m says create the home dir, and -k provides the skeleton directory to use.


9

The command that you must use for you is: id and for any other user: id username


8

I presume you're finding this list of users by checking /etc/passwd? This is totally normal - 'users' serve to carry a set of permissions, useful for locking down not just 'actual users' but also programs to certain areas of your system and tracking what they changed (same concept with groups). I've inserted one of my Raspberry Pi /etc/passwd files below ...


8

With write: write <user> Some text goes here CTRL-D (eof) Alternative: echo "Some text goes here" | write <user> See man write.


8

This means that it is disabled for direct login. It is a user that is used for running services or to be used for rlogin. Check https://en.wikipedia.org/wiki/Passwd#Password_file


7

You can login as the user or simply su from root to the user and run the command history you can also search history quite easily history | grep "what ever" Finally you can use ctrl+r {whatever}


7

You submit a support call to IBM who then give you the hscpe user password, which is good for one day. That user ID and password allows you to gain access to root (assuming you recorded the root password when you installed the HMC). Then you can cat /etc/shadow. You can't do it without root access (by design), and you can't simply switch to root either ...


7

Yes. The normal/unprivileged user can write to /tmp and /var/tmp, for legitimate reasons. Also, if the user or group permissions of a given file/directory includes those of the user, he or she can write to those files or directories as well. Having said that, providing write capability to operating system files and directories to a normal user, is shooting ...


6

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


6

The nobody user is a pseudo user in many Unixes and Linux distributions. According to the Linux Standard Base, the nobody user and its group are an optional mnemonic user and group. That user is meant to represent the user with the least permissions on the system. In the best case that user and its group are not assigned to any file or directory (as owner). ...


6

You can read ~/.bash_history file in users folder if you are admin or have special permissions.


6

pw is the command you are looking for. To add user klaatu to the group foo, do: pw groupmod foo -m klaatu Here is the FreeBSD handbook page on the subject. It's an easy and informative read: Users and Basic Account Management


6

You can use eval to get someone's home directory. eval echo "~$USER" At least for local users this works for sure. I don't know if remote users like LDAP are handled with eval.


5

An email thread: http://www.sudo.ws/pipermail/sudo-users/2002-September/001225.html http://www.sudo.ws/pipermail/sudo-users/2002-September/001226.html .. points out that sudo -u nobody [cmd ...] can be used: (Combined with the trick of How to append to a file as sudo) echo "Hello World" | sudo -u nobody tee -a /tmp/logfile.log


5

Easier to do groups [username] If you want to list all local users and their local groups you can do cat /etc/passwd | awk -F':' '{ print $1}' | xargs -n1 groups If you get "groups: command not found", it is likely you've edited your environmental path for the worse, to reset your path do PATH=$(getconf PATH)


5

/tmp and possibly /var/tmp are writtable to any users.


4

chage -l <username> Example Output: Last password change : Dec 17, 2015 Password expires : Mar 16, 2016 Password inactive : never Account expires : never Minimum number of days between password ...


4

The really right way? Say you want to change user 'peter' to 'paul'. groupadd paul usermod -d /home/paul -m -g paul -l paul peter This changes the name, the group, the home directory and ownership and group of of that directory to the new ones, along with all the files. You end up with a user indistinguishable from having been originally created as ...


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


4

The user pagagne will need to logout and login to his/her shell for the group to be visible in his groups. You could also check if the user has indeed been added to the group: groups pagagne


4

You can use NFSv3 to map on user and group IDs. If you don't want to map on IDs use NFSv4 instead which maps on user- and groupnames. So if you have two different clients who have a user called user-host-a and user-host-b who both have UID 500 they both have access to the files when NFSv3 is used. When you have two different clients who have a user called ...


4

usermod is a tool for modifying the local /etc/passwd database. It cannot be used to modify accounts delivered through Active Directory. id on the other hand looks up any user account regardless of its source. (Actually this is controlled with the passwd setting in nsswitch.conf but if you have integrated AD you'll be using multiple sources.) As mentioned ...



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