Tag Info

Hot answers tagged

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


4

getent group somegroupname || groupadd somegroupname


3

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.


3

if created and not touched since the user creation you can use the .bash_logout file to determine the date. As root run: ls -l /home/<username>/.bash_logout OR, If the user has a home directory, you can check that directories creation date: ls -ld /home/username/ to get only the date you can use awk: ls -ld /home/username/ | awk '{ print ...


2

Here's a summary of the commands I used on a Debian system: groupadd NEW usermod -l NEW -m -d /home/NEW -g NEW OLD chfn -f "New Fullname" NEW cd /home ln -s NEW OLD The last two commands create a symbolic link from the name of the old home directory (/home/OLD) to the name of the new one (/home/NEW).


2

Since no input example is given, I'm going to assume a very basic patern: Uesrs groups a p,r,t b p,q In that case you have several options, because usermod -G can use the second column natively. something like while read line do usermod -G "$(cut -f2 -d" ")" $(cut -f1 -d" ") done < users.txt The while loop reads each line from users.txt, and ...


2

If you use a custom shell as suggested by Arcege and 2bc, then that shell will receive the command which the user intends to execute as an argument because the shell is invoked like this: shellname -c the_original_command So ignore the -c (that your $1) and find the command in $2. For example: #!/bin/sh case "$2" in on) do something ...


2

passwd -l <user> doesn't stop all possible means of logging in. For example, if they log in using ssh with public keys they can still login as they won't need a password. To stop the user logging in again, edit the /etc/passwd file and remove the user or change the 7th column to /sbin/nologin. Run: ps -u <user> to see what process the ...


1

passwd -l <user> does not disable the account.as gareth said the user may still can login using another authentication token such as SSH key. to disable this account you should use usermod --expiredate 1 this set the account expire date to 1970. Now you should kill all processes the user is started. running: $pgrep -u Foo will print all processes ...


1

First grep all the 'test' user's process and kill -9 all pid's then delete the user. pgrep -u test ps -fp $(pgrep -u test) killall -KILL -u test userdel -r test


1

Have you tried killing all the user's processes with the SIGKILL? pkill -KILL -u username


1

id -u somegroupname &>/dev/null || groupadd somegroupname since id -u somegroupname will return non-zero if it doesn't exist.


1

The best and simplest approach would be to parse a file with the required information as suggested by @DannyG. While that's the way I would do it myself, another would be to hardcode the user/groups combinations in your script. For example: #!/usr/bin/env bash ## Set up an indexed array where the user is the key ## and the groups the values. declare -A ...


1

Given your comments, you can just statically build the script with the groups hard-written in it. This script expect a list of users, one user per line, on the standard input. So call it with ./script < users.txt for example. #!/bin/bash groups="p q r" # the list of all groups you want your users in # the following function is a case statement # it ...


1

Using groupadd to add groups to the system requires root privileges. Maybe you just need newgrp [newgroup]. This makes [newgroup] your primary group and adds the group to your group list (see cmd groups). Of course, first your system administrator has to put you in [newgroup], but you don't have to logout and in.


1

As the other answerers said, this is the default behavior. If you really want to enter the root password instead of the user's password, you can add the line Defaults rootpw to your /etc/sudoers file (use the visudo command, do not edit the sudoers file by any other means). The usual disclaimer: The defaults chosen for sudo are the way they are for a ...


1

Well it is how it's done. You will grant the permission to users of group wheel to perform administration duties. In short you grant them root access. And this is not distro specific - in all Linux distributions and even BSDs you will do the same. If you're worried about compromising security you could remove the user from sudoers table and go with root. ...



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