LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   With PS you can not control the processes of another user (https://www.linuxquestions.org/questions/linux-server-73/with-ps-you-can-not-control-the-processes-of-another-user-862796/)

bellotranzi 02-15-2011 04:57 AM

With PS you can not control the processes of another user
 
Hi everybody,

I have a problem with the permission of the directories under /proc, they are readable and accessible only by Owner (they have permission 500 instead of the usual 555) As a consequence, the processes are visible only to the Owners or to Root. For exampleif I want to check if there is mysql

# ps -ef | grep mysqld
mysql 2611 1 0 12:14 ? 00:00:06 /usr/sbin/mysqld

I see it only with the user mysql or with root because the directory has permission 500
dr-x------ 6 mysql mysql 0 2011-02-11 12:14 /proc/2611/

this problem obstacles the functioning of some applications that should check the existence of some processes managed by other users. At the beginning all was working well. But after a while the problem appeared and I don’t know which is the reason of it.


Can you tell me how to restore the standard management of permissions of / proc?]

I have a Ubuntu server Maverick 10:10.

Thanks.

Sayan Acharjee 02-15-2011 08:28 AM

Quote:

Originally Posted by bellotranzi (Post 4258924)
Hi everybody,

I have a problem with the permission of the directories under /proc, they are readable and accessible only by Owner (they have permission 500 instead of the usual 555) As a consequence, the processes are visible only to the Owners or to Root. For exampleif I want to check if there is mysql

# ps -ef | grep mysqld
mysql 2611 1 0 12:14 ? 00:00:06 /usr/sbin/mysqld

I see it only with the user mysql or with root because the directory has permission 500
dr-x------ 6 mysql mysql 0 2011-02-11 12:14 /proc/2611/

this problem obstacles the functioning of some applications that should check the existence of some processes managed by other users. At the beginning all was working well. But after a while the problem appeared and I don’t know which is the reason of it.


Can you tell me how to restore the standard management of permissions of / proc?]

I have a Ubuntu server Maverick 10:10.

Thanks.

Err....why don't you change the permission of /proc to 555?

Code:

#chmod 555 /proc

cepheus11 02-15-2011 09:09 AM

Quote:

Originally Posted by bellotranzi (Post 4258924)
For exampleif I want to check if there is mysql

# ps -ef | grep mysqld

There are better ways to check if mysqld is running (or any service):

Code:

$ /etc/init.d/mysql status
or

Code:

$ service mysql status
(depending on your distribution)

Or test for the pid file:

Code:

$ test -e /var/run/mysqld/mysqld.pid
(exact path depends on destribution and maybe on version)

You could also check the output of netstat for the port mysql listens to, but this would be less clean and future-proof.


All times are GMT -5. The time now is 12:04 PM.