Koozali.org: home of the SME Server

User shell access some commands not available?

paulmancan2

User shell access some commands not available?
« on: March 22, 2005, 11:26:31 PM »
I'm used to accesing my server by SSHing in as root. I'd like to drop this bad habbit so I gave my user a bash shell.

When I su to root however, do I not get root's path variables? ie. as root this way gives me ""command not found" on commands I can use by logging in directly as root.

Thanks!

Offline raem

  • *
  • 3,972
  • +4/-0
Re: User shell access some commands not available?
« Reply #1 on: March 23, 2005, 03:04:12 AM »
paulmancan2

> I'm used to accesing my server by SSHing in as
> root. I'd like to drop this bad habbit so I gave
> my user a bash shell.

I need to do this also.
I gather we need to give the user sudo rights and configure the shell for them (with the path variables)

Then issue commands like
sudo whatever

I'm sure the informatiomn is out there somewhere, can anyone provde the specifics please.
...

Offline raem

  • *
  • 3,972
  • +4/-0
Re: User shell access some commands not available?
« Reply #2 on: March 23, 2005, 03:09:49 AM »
> I'm sure the informatiomn is out there somewhere, can anyone provde the specifics please.

well I already knew to look at
/etc/sudoers

and of course we can all do
man sudoers

I just never got around to fully working it out.

Anybody have a sample /etc/suders file they want to share ?
...

Offline raem

  • *
  • 3,972
  • +4/-0
Re: User shell access some commands not available?
« Reply #3 on: March 23, 2005, 10:37:32 AM »
paulmancan2

log in as root and do
chsh -s /bin/bash username

to stop the user having access do
chsh -s /bin/sshell username

You can use different shells depending on your requirements:

chsh -s /bin/csh username
chsh -s /bin/bsh username
chsh -s /bin/bash username
chsh -s /bin/bash2 username

As well you probably want to set up sudoers list to allow users to have root access rights.

There is a contrib by daniel van raay that adds a panel to server manager to set sudo access for users.

...or using command prompt
you need to do something like this in /etc/sudoers

# User privilege specification
root         ALL=(ALL) ALL
username     ALL=(ALL) ALL


You would issue commands like
sudo command

I think the password expiry time is 5 minutes by default so you have to re-enter it after that time.
...

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: User shell access some commands not available?
« Reply #4 on: March 24, 2005, 02:42:13 AM »
Quote from: "paulmancan2"
I'm used to accesing my server by SSHing in as root. I'd like to drop this bad habbit so I gave my user a bash shell.

When I su to root however, do I not get root's path variables?


Try "su -".

paulmancan2

User shell access some commands not available?
« Reply #5 on: March 26, 2005, 09:44:26 PM »
Thanks Charlie that is the ticket. If you have a chance would you explain why this is (ie. su root vs su -) Thanks!

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
User shell access some commands not available?
« Reply #6 on: March 26, 2005, 09:58:52 PM »
Quote from: "paulmancan2"
Thanks Charlie that is the ticket. If you have a chance would you explain why this is (ie. su root vs su -)


"man su".

[Remember that Google is your friend. Knows more than I do, and works 24 hours.]

paulmancan2

User shell access some commands not available?
« Reply #7 on: March 31, 2005, 09:25:05 PM »
Google is down right now :P

My apologies for the laziness.