sumit vedi
sumit vedi

Reputation: 119

pass the password in su command in linux itself

I am facing some problem, Actually i want to kill the process/script which is running by another user but i have credential of that user. Infact when i am using sudo, command is prompting the below error.

csaadm is not in the sudoers file.  This incident will be reported.

After that i have used the below command but it is asking for password, and i want to pass the password in su itself.

su pwcadm -p pwcadm -c "kill -9 29205"

Is there command please help.

Upvotes: 1

Views: 5469

Answers (2)

kumar
kumar

Reputation: 19

echo password |su -c "pkill -9 java" user

Upvotes: 1

kali
kali

Reputation: 1

If you have root privileges you can use setuid to change the user id of the process/script. So you can set it to root and start the script as normal user. More info on Wikipedia

If you have no root privileges you also shouldn't be able to stop a process of another user.

Upvotes: 0

Related Questions