LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   change user and list of users accounted on system (https://www.linuxquestions.org/questions/linux-newbie-8/change-user-and-list-of-users-accounted-on-system-522749/)

Mangenius 01-25-2007 12:43 PM

change user and list of users accounted on system
 
This is a basic newbie question. I want to do two things.

I want to check what users and groups have been created for the system, as opposed to checking what users are currently logged on. I'm actually looking for a particular user, if it exists on the machine; so, that's where that question comes from.

I also want to know, once I find the user I'm seeking out, how do I log on as another user for a particular program. I'm running nagios, and it says it's running, but I can't interface with it. My guess is I started it with a user that has no business accessing it, if that makes any sense at all. I can use a command called chown, right, but I'm not sure how to use it to make it work for this particular situation.

thank you very much.

fooks 01-25-2007 01:04 PM

Hi, try this to check who is logged in:

Code:

$ who -a
$ w
$ man who
$ man w

:study:

to check if user with specified username exists on the system:
Code:

$ id skiff
uid=545(skiff) gid=545(skiff) groups=545(skiff)
$
$ id fakeskiff
id: fakeskiff: No such user

$ man id


More reliable is to check against /etc/passwd, /etc/group:
Code:

$ cat /etc/passwd | grep skiff
skiff:x:545:545::/home/skiff:/bin/bash

or

$ grep skiff /etc/passwd
skiff:x:545:545::/home/skiff:/bin/bash

$ cat /etc/passwd | grep fakeskiff

$ grep skiff /etc/group
skiff:x:545:
$

To execute command as another user use sudo:

Code:

$ sudo -H -u skiff ls -la
$ man sudo

:study:
but mind, you need to have /etc/sudoers properly configured...

Mangenius 01-25-2007 01:28 PM

Thank you so much! I don't even see sudoers; so, I guess that means it has to be configured to work.

Anyway, this stuff is great. I pointed to the correct IP for nagios and it worked. It was a social engineering mistake on my part. I presuppose root has the permissions to run anything it wants! And I'm also presupposing root cannot execute some magic command to see the users' passwords, except by doing some sort of password recovery.

The only thing I still don't quite get is the change owner or group for file permissions. How would one change ownership for an entire program, for instance?

thank you in advance.


All times are GMT -5. The time now is 02:17 AM.