LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-18-2017, 04:03 PM   #1
rockyx
LQ Newbie
 
Registered: Apr 2017
Posts: 1

Rep: Reputation: Disabled
Change uid from user who had uid=0 (but not is root)


Hi friends,

I have a server linux: Red Hat Enterprise Linux Server release 6.7 (Santiago)

I found a user who had a uid=0, like root user. I want to return its old number UID (which is 500), but I have the following error:

[root@SERVER /]# usermod -u 500 -o userav
usermod: user userav is currently used by process 1

[root@SERVER /]# cat /etc/passwd | grep userav
userav:x:0:0:userav:/home/userav:/bin/bash

I don't know what I can do.

Best regards,

Rockyx.
 
Old 04-18-2017, 07:44 PM   #2
rigor
Member
 
Registered: Sep 2003
Location: 19th moon ................. ................Planet Covid ................Another Galaxy;............. ................Not Yours
Posts: 705

Rep: Reputation: Disabled
Hi rockyx,

I'm not aware of, nor have I been able to find, any special significance to "userav".

So it would seem most likely that the usermod command is just checking to see if the user ID is in use, which since that's also root's user ID, naturally it is.

If it were me, I'd bring the system down to the single user state, then manually edit the associated file(s) to restore the ID. Finally, reboot.

HOWEVER, PLEASE NOTE, if I were administering that system, I would want to know how the ID got changed in the first place, and what might be associated with it. Whether it's related to a so-called "root kit", or something legitimate running on the system. Naturally if it's a "root kit" I'd "lock down" the system and check it throughly. If it's something legitimate, I'd be concerned that something might need to be done before changing it back.

IF AND ONLY IF, it's just a matter of getting past the usermod command's objections, then the manual edit and reboot should do it.

Last edited by rigor; 04-18-2017 at 07:45 PM.
 
Old 04-18-2017, 08:21 PM   #3
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
I agree with @rigor not that I know anything about server side Linux. though I know if it is being used when your running. you got a get it like he said. Or me with dual boot. I just boot my other Linux and mount the one I need to do something with so whatever process will not be running so I can change it.

perhaps that is why I never really learned the single user mode operation way of doing things.

but diffidently a need to know how it got that way has raised its head. so who ever or how ever it happened can be hopefully prevented from happening again.

Last edited by BW-userx; 04-18-2017 at 08:24 PM.
 
Old 04-19-2017, 01:25 AM   #4
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
i suspect a tip-of-the-iceberg sort of problem.
 
Old 04-20-2017, 08:17 AM   #5
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
Indeed, if that user had uid=0, that user was root!

I would therefore speculate that your system has been thoroughly compromised. I can think of no legitimate reason for any other user to have uid=0, and plenty of illegitimate ones.
 
1 members found this post helpful.
Old 04-24-2017, 05:13 PM   #6
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,794

Rep: Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201
A shortcoming of usermod.
You can change the users uid in /etc/passwd by means of vi.
You don't need single-user mode for that.
 
2 members found this post helpful.
Old 04-25-2017, 09:30 PM   #7
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
Quote:
Originally Posted by MadeInGermany View Post
A shortcoming of usermod.
You can change the users uid in /etc/passwd by means of vi.
You don't need single-user mode for that.
Except that, in most systems, /etc/passwd is not the actual file.

Normally, a "shadow file" in /etc/shadow is the actual file that is consulted. And you cannot touch it.
 
Old 04-26-2017, 03:50 AM   #8
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,794

Rep: Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201
No, in most systems /etc/passwd is the actual file, and the uid is in the 3rd field.
 
Old 04-26-2017, 08:54 PM   #9
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
Quote:
Originally Posted by MadeInGermany View Post
No, in most systems /etc/passwd is the actual file, and the uid is in the 3rd field.
/etc/passwd is maintained, to be a "well-known data source for compatibility purposes," but it does not contain actual authentication information.

In a "simple standard Linux" setup these days, authentication data is in /etc/shadow, which is protected. So far as I know, it is the true authority. (As it should be.)

In other possible configurations, there might well be no shadow-file: the authority could well be an LDAP (Microsoft OpenDirectory®) server, or Kerberos®, maintained by the corporate security team.

Nevertheless, /etc/passwd and /etc/group are often "maintained" for the benefit of all those existing scripts and other programs that expect to be able to pore through them.

Last edited by sundialsvcs; 04-26-2017 at 08:58 PM.
 
Old 04-26-2017, 09:42 PM   #10
Laserbeak
Member
 
Registered: Jan 2017
Location: Manhattan, NYC NY
Distribution: Mac OS X, iOS, Solaris
Posts: 508

Rep: Reputation: 143Reputation: 143
Quote:
Originally Posted by sundialsvcs View Post
Indeed, if that user had uid=0, that user was root!

I would therefore speculate that your system has been thoroughly compromised. I can think of no legitimate reason for any other user to have uid=0, and plenty of illegitimate ones.
I would agree. I've been a UNIX administrator before and any user, whatever the name, whose id is 0 has root powers. You have a MAJOR problem on your hands.
 
Old 04-27-2017, 01:49 PM   #11
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by sundialsvcs View Post
/etc/passwd is maintained, to be a "well-known data source for compatibility purposes," but it does not contain actual authentication information.

In a "simple standard Linux" setup these days, authentication data is in /etc/shadow, which is protected. So far as I know, it is the true authority. (As it should be.)
There are no numeric UIDs or GIDs in /etc/shadow. That information is in /etc/passwd only. The /etc/shadow file contains just the user names and their associated password and account expiration information.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Root user uid got changed 0 to 1 rajsridhar Ubuntu 4 02-12-2015 10:35 AM
Change UID for a user ... things to consider j-me Linux - Newbie 5 03-04-2010 01:27 PM
(pam_unix) session opened for user root by (uid=0) frenchn00b Debian 1 01-01-2008 07:18 AM
How can I change a user's uid and gid? homesp Debian 2 05-31-2005 02:39 PM
FREEBSD5.3 platform: PHP setcookie() successful, but $uid = $_COOKIE['uid']; fail tclwp Programming 1 03-30-2005 08:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration