Sample Header Ad - 728x90

Unix & Linux Stack Exchange

Q&A for users of Linux, FreeBSD and other Unix-like operating systems

Latest Questions

4 votes
4 answers
43287 views
It says always I'm not in "sudoers" file!
I migrated from Ubuntu-20 to Debian-12, and I can't excute the command `sudo` with my username `my_name` within a fresh installed system. So, I added `my_name` into "sudo" group(`usermod -aG sudo my_name`) within a root logged-in terminal, and then rebooted my computer. But it doesn't work, I still...
I migrated from Ubuntu-20 to Debian-12, and I can't excute the command sudo with my username my_name within a fresh installed system. So, I added my_name into "sudo" group(usermod -aG sudo my_name) within a root logged-in terminal, and then rebooted my computer. But it doesn't work, I still get the message like "my_name is not in sudoers file...". I found a strange thing, i.e. when I issue groups command within a terminal window that logged-in as my_name, the "sudo" group name do **NOT** exist in the group list. But when I execute groups my_name with root's permission, the "sudo" group name **DO EXIST** in the group list! Is this a bug of Debian-12? Or I missed some action?
Leon (203 rep)
Sep 12, 2023, 02:38 AM • Last activity: Mar 3, 2025, 08:26 AM
0 votes
1 answers
83 views
usermod and groupmod inconsistency for removing multiple users/groups
I don't understand why `usermod` has a `-r` option that can be used in combination with `-G` to remove groups that the user belongs to, but `groupmod` doesn't have an option to remove multiple users from a group. Both however have `-a` to append users / groups. Is there a reason for this inconsisten...
I don't understand why usermod has a -r option that can be used in combination with -G to remove groups that the user belongs to, but groupmod doesn't have an option to remove multiple users from a group. Both however have -a to append users / groups. Is there a reason for this inconsistency? Is it just me, or some of these commands are poorly made and documented? I have to spend some good time figuring out some things.
Neox (111 rep)
Jul 21, 2024, 03:42 PM • Last activity: Jul 22, 2024, 02:32 PM
11 votes
6 answers
11315 views
Completely lock user account on server, including ssh
I need to lock some user accounts, without messing with their HOME, if at all possible. Normal way would be `usermod -L user` but it seems to leave open ssh login with public key authentication (routinely used on this server). I know I could just `mv /home/user/.ssh /home/user/_ssh` or something sim...
I need to lock some user accounts, without messing with their HOME, if at all possible. Normal way would be usermod -L user but it seems to leave open ssh login with public key authentication (routinely used on this server). I know I could just mv /home/user/.ssh /home/user/_ssh or something similar, but is that the right way of doing this? What am I missing?
ZioByte (910 rep)
Apr 29, 2022, 10:35 AM • Last activity: May 2, 2024, 03:48 PM
2 votes
2 answers
1282 views
How to change user home directory when in use by /usr/lib/systemd/systemd --user
After copying all contents of a user home directory I'm trying to change the home directory to the new location. But systemd prevents me from doing this. ``` # sudo usermod -d /data/home/user/ user usermod: user user is currently used by process 10050 # sudo ps -fp 10050 UID PID PPID C STIME TTY TIM...
After copying all contents of a user home directory I'm trying to change the home directory to the new location. But systemd prevents me from doing this.
# sudo usermod -d /data/home/user/ user
usermod: user user is currently used by process 10050
# sudo ps -fp  10050
UID          PID    PPID  C STIME TTY          TIME CMD
user       10050       1  0 Nov23 ?        00:00:03 /usr/lib/systemd/systemd --user
How can I achieve this ? I'd like to avoid stopping services or rebooting the server just to move a home directory The user is not logged on, I checked using sudo who
cat /etc/redhat-release 
Red Hat Enterprise Linux release 8.5 (Ootpa)
carl verbiest (471 rep)
Dec 5, 2022, 11:10 AM • Last activity: Apr 24, 2023, 12:21 PM
4 votes
2 answers
17901 views
Unable to add user to a group due to sssd?
I'm working on Fedora 29 x86_64 fully patched. I'm trying to add my user to the `dialout` group so I can open the modem: $ ls -Al /dev/ttyUSB0 crw-rw----. 1 root dialout 188, 0 Feb 22 19:27 /dev/ttyUSB0 $ sudo usermod -a -G dialout jwalton (Fri Feb 22 19:32:11:373072 2019) [sss_cache] [confdb_get_do...
I'm working on Fedora 29 x86_64 fully patched. I'm trying to add my user to the dialout group so I can open the modem: $ ls -Al /dev/ttyUSB0 crw-rw----. 1 root dialout 188, 0 Feb 22 19:27 /dev/ttyUSB0 $ sudo usermod -a -G dialout jwalton (Fri Feb 22 19:32:11:373072 2019) [sss_cache] [confdb_get_domains] (0x0010): No domains configured, fatal error! Could not open available domains usermod: sss_cache exited with status 2 usermod: Failed to flush the sssd cache. According to the Fedora boards at [Error when inserting user in a group](https://ask.fedoraproject.org/en/question/131310/error-when-inserting-user-in-a-group/) , one can remove SSSD. This is where the confusion arises. The Fedora message does not state why SSSD is installed or why it is not configured to allow one to modify groups. In addition removing SSSD looks heavy weight to me. And according to the [sssd(8)](https://linux.die.net/man/8/sssd) man page, *"SSSD provides a set of daemons to manage access to remote directories and authentication mechanisms."* The description makes SSSD's role even more confusing since sudo works and I'm not doing anything with remote directories. I'd like to know if there is a way to modify a user's groups without uninstalling software or configuring software. I guess I'd like to know how to go back to the old days where things "just worked" as expected. ----- $ sudo yum remove sssd Dependencies resolved. ================================================================================ Package Arch Version Repository Size ================================================================================ Removing: sssd x86_64 2.0.0-5.fc29 @updates 34 k Removing unused dependencies: adcli x86_64 0.8.2-2.fc29 @fedora 265 k c-ares x86_64 1.13.0-5.fc29 @fedora 221 k cyrus-sasl-gssapi x86_64 2.1.27-0.3rc7.fc29 @fedora 41 k libdhash x86_64 0.5.0-41.fc29 @fedora 60 k libipa_hbac x86_64 2.0.0-5.fc29 @updates 61 k libsss_autofs x86_64 2.0.0-5.fc29 @updates 65 k libsss_certmap x86_64 2.0.0-5.fc29 @updates 119 k libsss_idmap x86_64 2.0.0-5.fc29 @updates 77 k libsss_nss_idmap x86_64 2.0.0-5.fc29 @updates 89 k libsss_sudo x86_64 2.0.0-5.fc29 @updates 58 k python3-sssdconfig noarch 2.0.0-5.fc29 @updates 185 k sssd-ad x86_64 2.0.0-5.fc29 @updates 377 k sssd-client x86_64 2.0.0-5.fc29 @updates 249 k sssd-common x86_64 2.0.0-5.fc29 @updates 4.9 M sssd-common-pac x86_64 2.0.0-5.fc29 @updates 247 k sssd-ipa x86_64 2.0.0-5.fc29 @updates 708 k sssd-krb5 x86_64 2.0.0-5.fc29 @updates 83 k sssd-krb5-common x86_64 2.0.0-5.fc29 @updates 292 k sssd-ldap x86_64 2.0.0-5.fc29 @updates 141 k sssd-nfs-idmap x86_64 2.0.0-5.fc29 @updates 41 k sssd-proxy x86_64 2.0.0-5.fc29 @updates 138 k Transaction Summary ================================================================================ Remove 22 Packages Freed space: 8.4 M Is this ok [y/N]: N
user56041
Feb 23, 2019, 12:42 AM • Last activity: Apr 18, 2023, 01:04 AM
0 votes
0 answers
733 views
Change user ID of user in Linux, but don't touch the files in the home directory
I want to change the user ID of `www-data`, but not touch the files in the home directory. usermod man page: -u, --uid UID The new numerical value of the user's ID. This value must be unique, unless the -o option is used. The value must be non-negative. The user's mailbox, and any files which the us...
I want to change the user ID of www-data, but not touch the files in the home directory. usermod man page: -u, --uid UID The new numerical value of the user's ID. This value must be unique, unless the -o option is used. The value must be non-negative. The user's mailbox, and any files which the user owns and which are located in the user's home directory will have the file user ID changed automatically. The ownership of files outside of the user's home directory must be fixed manually. So is there a way to execute this without that side effect or do I have to edit /etc/passwd manually using sed or something like that?
Alex (446 rep)
Apr 14, 2023, 08:43 AM
7 votes
1 answers
14019 views
Difference between "usermod -aG" and "usermod -G" options
I'm preparing for the LPIC-1, exam 102, and was wondering what is the difference between these two commands with respect to options `-G` and `-aG`: 1) `usermod -G projectA, projectB jsmith` 2) `usermod -aG projectA, projectB jsmith` The user `jsmith` has its own default group, which is not listed ab...
I'm preparing for the LPIC-1, exam 102, and was wondering what is the difference between these two commands with respect to options -G and -aG: 1) usermod -G projectA, projectB jsmith 2) usermod -aG projectA, projectB jsmith The user jsmith has its own default group, which is not listed above among the groups/projects. As I understand from the man pages of usermod, in (1) jsmith is taken off the listed groups/projects. In (2), the user is appended to those groups listed after -G and this does not affect its belonging to its default group. Do I correctly interpret the usage of these two options?
WobblyWindows (777 rep)
Sep 10, 2020, 04:21 PM • Last activity: Feb 22, 2023, 10:22 AM
-1 votes
1 answers
457 views
Kali Linux freezes after I log in, but not if I log into root first and then switch user
I recently changed the default kali username and password via following a tutorial that used usermod commands. However, after logging back into the newly named account, the screen freezes on the wallpaper and is not responsive. However, if I boot up my PC and log into the root user first and then sw...
I recently changed the default kali username and password via following a tutorial that used usermod commands. However, after logging back into the newly named account, the screen freezes on the wallpaper and is not responsive. However, if I boot up my PC and log into the root user first and then switch user into my new account it works fine. The issue only occurs when I try to log into the account directly. I'm very new to Linux so I'm pretty confused. Any help would be greatly appreciated.
Hugh Wise (1 rep)
Oct 15, 2022, 03:21 AM • Last activity: Oct 23, 2022, 06:13 PM
1 votes
1 answers
1530 views
unable to add user to group fedora 29
I used groupadd to add a group so that I could manage with git some root owned scripts. I then used usermod to add a user to a group. The user is the currently logged in standard user and I am in a shell through su into the superuser account in the terminal. I logged out and logged back in again, ha...
I used groupadd to add a group so that I could manage with git some root owned scripts. I then used usermod to add a user to a group. The user is the currently logged in standard user and I am in a shell through su into the superuser account in the terminal. I logged out and logged back in again, having run sudo usermod -aGgroupname username as I always have done. After I logged back in as the standard user, the command groups continued to show just the user, but when I logged in to the superuser account and ran groups stdusername the output showed that the std user is a member of the new group. I don't understand how this can happen.
millerthegorilla (221 rep)
Mar 13, 2019, 02:36 PM • Last activity: Sep 6, 2022, 07:25 AM
0 votes
0 answers
39 views
Ramifications of renaming a user
I'm setting up two computers with MX Linux that will be nearly identical, with a lot of customization from the original distro. I installed and customized the first one for User1, and will basically clone that (using the MX snapshot tools), as the starting point for the User2 system. Because much of...
I'm setting up two computers with MX Linux that will be nearly identical, with a lot of customization from the original distro. I installed and customized the first one for User1, and will basically clone that (using the MX snapshot tools), as the starting point for the User2 system. Because much of the customization is stored in the /home directory, I'm using what MX calls a "personal" snapshot that includes the user-specific stuff in /home, rather than a generic respin, where User2 would be setup by the system during installation. So the starting point for User2 has User1 as the primary user. My plan is to rename the user (UID 1000) to User2 (sudo usermod -l User2 User1). I need to also change their group to match (sudo groupmod -n User2 User1), and will need to clean up their home directory (sudo usermod -d /home/User2 -m User2). And other obvious user-centric things like their password and various preferences. I'm wondering if there are any non-obvious OS ramifications of the name change that I need to deal with. - One that occurred to me is file/folder/device ownership. It isn't clear whether these are associated by UID (which won't change), or username (which is how ownership is typically displayed). - I am assuming that system lists, like the sudoers file, and system provisions relating to things like auto-login and keyrings are associated by UID. Bottom line: other than group and /home, does changing the username affect anything operational (system-related), that I need to modify?
fixer1234 (701 rep)
Aug 28, 2022, 09:57 AM
0 votes
0 answers
1024 views
undo usermod for root?
At some point where I wanted to do sudo usermod -v 1000-1000 USER sudo usermod -w 1000-1000 USER I accidentally applied both these commands to `root`. According to the documentation I can undo these commands by using the same options in capitals, but when I try usermod -V 1000-1000 root then I get t...
At some point where I wanted to do sudo usermod -v 1000-1000 USER sudo usermod -w 1000-1000 USER I accidentally applied both these commands to root. According to the documentation I can undo these commands by using the same options in capitals, but when I try usermod -V 1000-1000 root then I get the message: usermod: user root is currently used by process 1. Is there another way to (un)do this?
alle_meije (579 rep)
Feb 28, 2022, 07:46 AM
2 votes
1 answers
4276 views
command to add multiple “secondary groups” for a user in Solaris
I am trying to add 2 secondary groups for a user is Solaris system, but not able to do so. It only adds 1 secondary groups. I've done enough R&D, not sure what to do. Below command I am using : ``` sudo usermod -g Primarygrp -G Secondarygrp1,Secondarygrp2 TJ252020 ``` when I verify whether groups ha...
I am trying to add 2 secondary groups for a user is Solaris system, but not able to do so. It only adds 1 secondary groups. I've done enough R&D, not sure what to do. Below command I am using :
sudo usermod -g Primarygrp -G Secondarygrp1,Secondarygrp2 TJ252020
when I verify whether groups has been added or not, I use below command :-
id -Gn TJ252020
o/p I am getting- > Primarygrp Secondarygrp1 o/p I want -> Primarygrp Secondarygrp1 Secondarygrp2
tani joshi (29 rep)
Aug 7, 2019, 07:29 AM • Last activity: Jul 16, 2021, 10:09 AM
1 votes
2 answers
6049 views
username is currently used by process
I am trying to change the home directory of a user. using `usermod ravishshankar --home /var/www/domainname/public_html/` but get `usermod: user username is currently used by process 1378` I try to `kill pid 1378` but get `bash: kill: pid: arguments must be process or job IDs` I tried `pkill -STOP -...
I am trying to change the home directory of a user. using usermod ravishshankar --home /var/www/domainname/public_html/ but get usermod: user username is currently used by process 1378 I try to kill pid 1378 but get bash: kill: pid: arguments must be process or job IDs I tried pkill -STOP -u user but still get process 8009 in user by the user.
mister mcdoogle (505 rep)
Jan 11, 2021, 01:53 AM • Last activity: Jan 11, 2021, 09:01 AM
-4 votes
3 answers
12896 views
Trying to change kali username, user is currently used by process
On a VMware Workstation Player VM, I have been trying to change my default user account name "kali". The command I tried was ```usermod -l newname kali```. But it gives me the error ```usermod: user kali is currently used by process 823```. Before anyone asks, yes I did this while logged in as root.
On a VMware Workstation Player VM, I have been trying to change my default user account name "kali". The command I tried was
-l newname kali
. But it gives me the error
: user kali is currently used by process 823
. Before anyone asks, yes I did this while logged in as root.
Cipher Visor (55 rep)
Aug 24, 2020, 01:33 AM • Last activity: Jan 3, 2021, 06:31 AM
0 votes
3 answers
1420 views
User and Group Management
While working on Linux Essentials, I was experimenting with removing a user (me) from a group I created. Following online instructions, I ended up deleting myself from all the default groups and my only membership is now in my own group. Here are my questions: 1. How do I remove a user from a specif...
While working on Linux Essentials, I was experimenting with removing a user (me) from a group I created. Following online instructions, I ended up deleting myself from all the default groups and my only membership is now in my own group. Here are my questions: 1. How do I remove a user from a specific group? If usermod allows addition using -a -G, there must be a similarly simple way to remove the user from the group. 2. Is there a command that I can use to restore my group memberships? (i.e., sudo group, xdm group, etc.) 3. Finally, does manually editing /etc/passwd or /etc/group manipulate group memberships, additions, and deletions? As mentioned above, I just finished Linux Essentials, so I'm a beginner. Please keep that in mind when giving your input and any instructions that it might include.
user2425931 (101 rep)
Jun 30, 2020, 05:03 PM • Last activity: Jun 30, 2020, 07:52 PM
0 votes
1 answers
5245 views
Give a user admin right to run yum on centos 8
I give a user admin access with: `usermod -a -G wheel userX` but when I log in with userX, I am not able to run `yum`. What do I need to do? Thanks
I give a user admin access with: usermod -a -G wheel userX but when I log in with userX, I am not able to run yum. What do I need to do? Thanks
Maryam (103 rep)
Jun 20, 2020, 03:08 PM • Last activity: Jun 22, 2020, 04:17 PM
3 votes
2 answers
1590 views
chgrp chown usermod are useless if not root?
I am logged under 'achille' achille belongs to 2 groups: groups achille achille: achille users I want to change the group owner of file 'tree.test' to group 'users' ls -l tree.test -rw-r--r--. 1 achille achille 2512881 Dec 1 11:53 tree.test I have got full control over my home dir: ls -ld $HOME drwx...
I am logged under 'achille' achille belongs to 2 groups: groups achille achille: achille users I want to change the group owner of file 'tree.test' to group 'users' ls -l tree.test -rw-r--r--. 1 achille achille 2512881 Dec 1 11:53 tree.test I have got full control over my home dir: ls -ld $HOME drwx------. 15 achille achille 4096 Dec 10 11:51 /home/achille I try: chown :users tree.test chown: changing group of 'tree.test': Operation not permitted I try: chgrp users tree.test chgrp: changing group of 'tree.test': Operation not permitted ok, so I decide to have as primary group the group 'users' usermod command is available to achille, so I use it (right?): usermod -g users achille usermod: Permission denied. usermod: cannot lock /etc/passwd; try again later I log as root to perform this operation (changing primary group) su - password: then usermod -g users achille and check it out: id -gn achille users then ctrl + D to log back to achille the file finally belongs to groups 'users' but the result is bad because my home dir and all files/dirs inside also belong to group users. I finally found a way (without beeing logged as root) with newgrp command: newgrp users id -gn users touch file0 file0 will have users as group owner but it looks like newgrp works as long as achille belongs to the group you want to change to otherwise you 've got this error message: newgrp games Password: (what password to put here?) newgrp: failed to crypt password with previous salt: Invalid argument ???? so now I am just wondering (and asking), if chgrp,chown,usermod are worth keeping in tools bag beeing an unprivileged user. thanx folks!
achille (213 rep)
Dec 10, 2019, 06:21 PM • Last activity: Jun 10, 2020, 03:53 PM
1 votes
2 answers
14643 views
Why doesn't "usermod" work under superuser?
The `usermod` command successfully through sudo. sudo usermod -aG some_group some_user However, if you execute it through su, then there will be an error. su ...I enter root password... usermod -aG some_group some_user bash: usermod: command not found Why it happens? How to configure my system? The...
The usermod command successfully through sudo. sudo usermod -aG some_group some_user However, if you execute it through su, then there will be an error. su ...I enter root password... usermod -aG some_group some_user bash: usermod: command not found Why it happens? How to configure my system? The fact is that I have a script that I cannot change. This script uses command usermod under su.
Alexander Rakhmaev (113 rep)
May 28, 2020, 11:03 AM • Last activity: May 28, 2020, 03:51 PM
0 votes
0 answers
64 views
Not being able to edit user's info in linux
I have managed to write this code. It runs, but no change was made to the user's info. It seems like `usermod` isn't working. What I am wanting to do is, to be able to edit existing user's info in the system? printf "\nEnter user name to edit: " read -r usermod [ -n $usermod ] && usermod $usermod un...
I have managed to write this code. It runs, but no change was made to the user's info. It seems like usermod isn't working. What I am wanting to do is, to be able to edit existing user's info in the system? printf "\nEnter user name to edit: " read -r usermod [ -n $usermod ] && usermod $usermod unset usermod echo " A user name has been edited"
Mukunda Paudel (1 rep)
Apr 11, 2020, 02:55 PM • Last activity: Apr 11, 2020, 05:03 PM
4 votes
2 answers
12348 views
Difference between expired account and inactive account
After a command like: `$ usermod -e -f bea` Bea's account will be expired, but still active (until tomorrow). What's the difference? What could happen yesterday and can't happen today? And what can happen today but not after tomorrow?
After a command like: $ usermod -e -f bea Bea's account will be expired, but still active (until tomorrow). What's the difference? What could happen yesterday and can't happen today? And what can happen today but not after tomorrow?
Sara1209 (51 rep)
Dec 25, 2019, 10:51 AM • Last activity: Dec 25, 2019, 06:42 PM
Showing page 1 of 20 total questions