The time now is Thu 26 Apr 2018, 06:03
All times are UTC - 4 |
Author |
Message |
droope

Joined: 31 Jul 2008 Posts: 811 Location: Uruguay, Mercedes
|
Posted: Thu 21 Jul 2011, 18:08 Post subject:
lower Subject description: runs command as non-priviledged user |
|
Hi folks!
Some apps are just not safe to be run as root - particularly my browser and my server - so I've decided that i don't want them to. In order to do so comfortably, I've created a script that lowers the privileges ( an anti-sudo, perhaps )
So, here it is:
Code: | #!/bin/bash
if [[ -n $@ ]]; then
# allows gtk to run
xhost local:lower@ > /dev/null
sudo -H -u lower $@
else
su lower
fi |
In order for it to work, you need sudo, which I attach below. Created using this guy's code ( thanks! ). Also, you need to create the "lower" user, which can be done with
Usage:
Firstly, you need to create a text file in "/usr/bin" called "lower". Insert the first block of code of this post inside that file, and give it execution rights ( tip: `chmod +x /usr/bin/lower`)
After that, you can use it like this
or
( you can use "exit" command to become root again )
_________________ What seems hard is actually easy, while what looks like impossible is in fact hard.
“Hard things take time to do. Impossible things take a little longer.” –Percy Cerutty
Mi blog (Spanish)
|
Back to top
|
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|
[ Time: 4.8616s ][ Queries: 11 (4.7633s) ][ GZIP on ] |