Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Tue 30 Jun 2015, 20:24
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » System
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count_1  
Author Message

Joined: 31 Jul 2008
Posts: 814
Location: Uruguay, Mercedes

PostPosted: Thu 21 Jul 2011, 18:08    Post_subject:  lower
Sub_title: 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 ) Very Happy

So, here it is:

if [[ -n $@ ]]; then
        # allows gtk to run
        xhost local:lower@ > /dev/null
        sudo -H -u lower $@
        su lower

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

adduser lower


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

#lower firefox



( 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
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count_1  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » System
Jump to:  

You cannot attach files in this forum
You can download files in this forum

Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0391s ][ Queries: 11 (0.0036s) ][ GZIP on ]