Tag Info

Hot answers tagged

6

You can get a list of all users with getent passwd | cut -d':' -f1 This selects the first column (user name) of the system user database. In contrast to solutions parsing /etc/passwd, this will work regardless of the type of database used (traditional /etc/passwd, LDAP, etc). Note that this list includes system users as well (e.g. nobody, mail, etc.). ...


6

If you change the file owner using chown, the permissions for alice would be transferred to bob. So here's the flow: sudo mv ~bob/Documents ~bob/Documents.orig sudo mv ~alice/Documents/ ~bob/Documents sudo chown -PR bob ~bob/Documents Edit: In case you want to overwrite the group as well, use sudo chown -PR bob:bob ~bob/Documents Or: sudo chown -PR ...


4

As Bob: mv ~bob/Documents ~bob/Documents.orig cp --remove-destination --no-preserve=ownership -r ~alice/Documents/ ~bob/ sudo rm -fr ~alice/Documents/


3

On Debian-based systems (including Ubuntu), packages create users using maintainer scripts, usually postinst. Therefore one way could be to grep through these scripts: grep -R --include='*.postinst' -e useradd -e adduser /var/lib/dpkg/info/ This assumes, of course, that the postinst script hasn't been deleted (either manually or because you uninstalled ...


3

nothing is guaranteed. root - is usually on linux/unix systems, but - i saw systems where uid=0 was used by "admin". Usually - there are users like root, nobody, daemon, bin, sys. www-data is on debian/ubuntu, but for example on redhat/centos/fedora/pld there is apache user instead. Recomendations/fixed uids for users other than root are only within ...


2

The personal data in /etc/passwd is user names, office locations and phone numbers. That's the 1970s version of the company phonebook. When Unix was designed, it was expected that people who have an account on the same machine would be members of the same organization (colleagues, fellow students, etc.). If you don't want your users to have access to that ...


2

I would have to agree. /etc/passwd has not contained very sensitive data for a while now. I believe /etc/shadow is where lots of data that needs to be protected should be stored.


2

cp -avv /home/alice/Documents/ /home/bob/newDocuments/ && chown -Rvv bob:bob /home/bob/newDocuments/


2

You could replace $USER with $(whoami) (a command that is built in on almost all Unix systems). As for why $USER isn't set, it's typically set by login. But since you're SSH'ing into the server instead of using an actual interactive shell, the $USER variable is (and several other environment variables are) never set.


2

I use Gentoo, So i would extract the 5th field of /etc/passwd to find the info: cat /etc/passwd | grep cron | gawk -F: '{print $5}' added by portage for cronbase Portage is package management system for Gentoo. So cron account is created by portage for the package cronbase.


2

AFAIK there is no native package manager function that creates (or removes) those functional /system users but that is done in a custom pre- or post-install script sections in RPM packages. Typically the RPM package will create and claim ownership of the home directory of those users e.g. the httpd package creates the user apache and the home directory of ...


1

Would the correct approach here be to change the "owner" of the files from what I assume is root to my FTP user? Yes. As root, run chown -R yourftpuser:yourftpgroup /path/to/tree. Your permissions will be fine for FTP at that point. All files will be owned by the FTP user, who has write access┬╣. In future, you can avoid this by cloning as the user you ...


1

useradd -m LOGIN creates the user's home directory


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

You could simply cat the /etc/passwd file or use, awk -F':' '{ print $1}' /etc/passwd To cut the first field of the same file, it'd list the names you're expecting. Additonally, w who and finger would help you with who all are logged in from which locations/tty and their activity details.


1

If bob has no permission to read alice's home folder you should do some operations as super user (if Bob has no already that power) I personally will use something like this: sudo rsync -a --progress /home/alice/Documents/ /home/bob/Documents/ sudo chown -Rv bob:bob_group /home/bob/Documents sudo rm -rv /home/alice/Documents rsync is very versatile you ...


1

Warning: This is a crude way and may not work for all the users created by packages. Most of the packages that create users will be creating those user's home directories outside /home and most times their home directories will be part of the package. In such cases, you can rpm -qf such users home directory and find out the package. User ntp ...


1

Suppose the group id is "foo" using visudo to change sudo settings: The % symbol identifies a group %foo ALL = (root) /usr/bin/reboot As to password changes you will have to use a script that limits activity - sudo cannot do it all. Suppose the one special user is peewee Using visudo add: User_Alias SPECIAL peewee SPECIAL ALL = (root) NOPASSWD: ...


1

There are multiple newer ways to store this kind of data, including but not limited to LDAP and NIS. The question you have to ask is why there's private information in /etc/passwd in the first place.


1

If "nofile" is set to "unlimited" in /etc/security/limits.conf (or in files in limits.d) then the user cannot login.


1

i believe that your expectations can be viewed as two things . the first is to let many machines check their users against one central server , so we don't have to create a duplicate account and a credential on each client machine before logging in if we have already have this on the central server . a term describing such systems is single-sign-on . though ...



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