Tag Info

Hot answers tagged

19

Add the following in your ~/.ssh/config file: Host myserver.cz User tohecz Host anotherserver.cz User anotheruser You can specify a lot of default parameters for your hosts using this file. Just have a look at the manual for other possibilities.


16

There's no difference between an external drive and an internal drive in terms of the filesystem stored on it. The owner & group of the filesystem's root directory are stored in its root directory, the same way your root filesystem's owner & group are stored. A corollary of this is that because UIDs and GIDs are stored only numerically, if you ...


15

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


11

As your system has been compromised, no information you get from that system can be trusted. Only logs that are immediately shipped off to an external system can be trusted (such as real time remote syslog). Meaning if you've got some nightly log rotation to an NFS share, you cannot trust it. However it is possible the user did not bother covering his/her ...


11

The major difference between sudo and su is the mechanism used to authenticate. With su the user must know the root password (which should be a closely guarded secret), while with sudo the user uses his/her own password. In order to stop all users causing mayhem, the priviliges discharged by the sudo command can, fortunately, be configured using the ...


9

Since the release of 0.9 Docker has dropped LXC and uses its own execution environment, libcontainer. Your question's a bit old but I guess my answer still applies the version you are using. Quick Answer: To understand the permissions of volumes, you can take the analogy of mount --bind Host-Dir Container-Dir. So to fulfill your requirement you can use any ...


9

The man page of passwd(1) says about passwd -l: Note that this does not disable the account. The user may still be able to login using another authentication token (e.g. an SSH key). To disable the account, administrators should use usermod --expiredate 1 (this set the account's expire date to Jan 2, 1970). So usermod --expiredate 1 [LOGIN] ...


9

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


8

I'm not sure how standard it is, but at least in Ubuntu systems sudo sets the following environment variables (among others - see the ENVIRONMENT section of the sudo manpage): SUDO_UID Set to the user ID of the user who invoked sudo SUDO_USER Set to the login of the user who invoked sudo for example, steeldriver@lap-t61p:~$ sudo sh -c ...


8

In Linux/Unix the user with user id 0 is such a super administrator. The user is usually called "root", but the magic is really behind the id and not the name. That user is especially not bound to local file access permissions and can read and write any file. That user also has the ability to change to any other user without needing a password.


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


7

You basically have 2 options. Use the local authentication system of each machine, and push out credential changes to all of them. Use a centralized authentication server. 1. Synchronized local authentication There are multiple products which accomplish this easily. Puppet, Chef, Ansible, and Salt are a few of the more common ones. All these tools fall ...


6

Yes, it's normal. The root user can do anything (including, say, changing a user's password, logging in as them, and changing it back), so they aren't restricted by su (or sudo). That includes password prompts and any other restrictions. The PAM configuration can be set up to have su present certain prompts to the root user still, for example encryption ...


6

There are two commands related to root privileges, SUDO and SU. With SUDO, you don't become another user (including root). SUDO has a pre-defined list of approved commands that it executes on your behalf (this addresses what I asked in the comment about how you give selected users selective privileges). Since you are not becoming root or another user, you ...


6

Use the who comand. It lists all logged-in users. It's not just SSH users, it will also list users on the console and directly-connected terminals (if you have any). For SSH users, it will show where they're connected from.


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


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

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


6

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}


5

A user is created by default as a locked account. The field that should contain the password hash in /etc/shadow will contain !!. When an account is locked, that account is available to root only (root can su but logins aren't allowed). If you 'unlock' the account which simply removes the !! you will be allowed to change the password. [root@test ~]# su - ...


5

If the server has getent, and allows users to view such information, you may be able to use getent group stat_bs. This will give you a list of users, separated by commas. If getent group is disallowed, you still might be able to read the passwd database with getent passwd. You can then correlate the GID (the fourth column) with the desired group.


5

Yes, by using ACL. (if not avail, install via yum install acl) Edit: Before you start setting ACL, you initially need to enable ACL support for filesystem, for doing it manually use: mount -o remount,acl $filesystem But you need to enter this command every time you boot the system. To avoid this, it can be enabled when the filesystem is mounted, ...


5

That's how sudo works. You trust the user and the user's actions are logged. If you want to enter the root password, then you want to use the su command as follows:- su -c yum install <package> Password: Once the command above finishes, you're returned to your normal user's prompt.


5

getent group somegroupname || groupadd somegroupname


5

You can add the files you want to /etc/skel directory. $ sudo touch /etc/skel/test.txt $ sudo useradd -m test $ ls /home/test test.txt From man useradd: -k, --skel SKEL_DIR The skeleton directory, which contains files and directories to be copied in the user's home directory, when the home directory is created by ...


5

sudo usermod -c "Jecht Tyre" jecht You can change it with -c option. -c is for adding comment usermod -c "YOUR NAME" username


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

It means that the password is locked. Tools, such as usermod -L add a ! to the password to invalidate it. usermod -U removes the !. From man 5 shadow If the password field contains some string that is not a valid result of crypt(3), for instance ! or *, the user will not be able to use a unix password to log in (but the user may log in the system by ...


5

R Perrin has it right. But it is a far better thing to login to a system via ssh as a "normal user", and become root should the need arise. One of the recommended hardening activities for a *NIX box is to disallow remote root login.


5

Does your system use Pluggable Authentication Modules (PAM)? Most modern Linux or BSD use PAM. PAM allows you to hook into logins. There are a variety of PAM modules available which might meet your needs, or you can write your own in C. There is even a pam-python* binding which allows you to hook in Python code. Given that you want the daemon to be running ...



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