Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Howto setup user to use only ssh and poweroff command?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
gpstefansson
n00b
n00b


Joined: 31 Oct 2006
Posts: 17

PostPosted: Mon Nov 26, 2007 9:31 am    Post subject: Howto setup user to use only ssh and poweroff command? Reply with quote

Hi all,

the title pretty much says it all... How do I set up a user that can connect to my Gentoo box through ssh and poweroff the machine? It is better if the user cannot logon to do other things...

thanks!
_________________
Gentoo 2.6.17-r8 x86_64 running on:
Asus K8S-MX motherboard, 1GB Kingston DDR400, AMD Sempron 2600+ Processor, nVidia GeForce 6200 Graphics card.
Back to top
View user's profile Send private message
di1bert
l33t
l33t


Joined: 16 May 2002
Posts: 963
Location: Oslo, Norway

PostPosted: Mon Nov 26, 2007 10:06 am    Post subject: Reply with quote

There is a number of ways to do it. I'd set him up in sudo for the shutdown command
and create a very simply dialog front end script and make this his shell.
That way when he logs in he always gets the dialog script and can only
use the shutdown command.

Let me know if you'd like a hand with this.

-m
Back to top
View user's profile Send private message
gpstefansson
n00b
n00b


Joined: 31 Oct 2006
Posts: 17

PostPosted: Mon Nov 26, 2007 10:59 am    Post subject: Reply with quote

Thanks for the reply dilbert!

What I am basically looking for is to allow this user to execute a single command using for example Putty, from Windows that runs the poweroff command. See: here.
Then I would place the call to Putty in a .bat file with all parameters there so that the user would only have to execute the .bat file to power off the Gentoo box. The user needs no other access to the machine.

Im just wondering if a dialog front end script is needed for this... Trying to keep this simple and quick :)
_________________
Gentoo 2.6.17-r8 x86_64 running on:
Asus K8S-MX motherboard, 1GB Kingston DDR400, AMD Sempron 2600+ Processor, nVidia GeForce 6200 Graphics card.
Back to top
View user's profile Send private message
di1bert
l33t
l33t


Joined: 16 May 2002
Posts: 963
Location: Oslo, Norway

PostPosted: Mon Nov 26, 2007 11:13 am    Post subject: Reply with quote

That makes it even more simple....

Just create a script with the following in it
Code:

sudo /sbin/halt


and put it in the users home directory. Then use putty / putty-keygen to create keys for
a passwordless login and run this command / script from putty (there is an option to put a "remote command to run")...

Should be a snap to do.

-m
Back to top
View user's profile Send private message
Dagger
Retired Dev
Retired Dev


Joined: 11 Jun 2003
Posts: 765
Location: UK

PostPosted: Mon Nov 26, 2007 12:00 pm    Post subject: Reply with quote

dont forget to:
Code:

emerge sudo

and add
Code:

USERNAME   ALL=(ALL)       NOPASSWD: /sbin/halt # change USERNAME to your user name

to your /etc/sudoers file
_________________
95% of all computer errors occur between chair and keyboard (TM)
Join the FSF as an Associate Member!
Post under CC license.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
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