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 Wed 17 Dec 2014, 22:27
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » System
lower
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count_1  
Author Message
droope


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:

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

Code:
adduser lower


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

Code:
#lower firefox


or

Code:
#lower
#firefox

( you can use "exit" command to become root again )
sudo-1.7.4.pet
Description 
pet

 Download 
Filename  sudo-1.7.4.pet 
Filesize  365.63 KB 
Downloaded  199 Time(s) 

_________________
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:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0409s ][ Queries: 12 (0.0041s) ][ GZIP on ]