Koozali.org: home of the SME Server

Disable shell access to root

Offline tetedekloo

  • *
  • 8
  • +0/-0
Disable shell access to root
« on: May 22, 2011, 11:58:55 AM »
Hello,

I did a little mess up around in my root folder with rsync command and --delete-after, on a fresh sme 7.5.1.

Since now, my root account have a bash access instead of regular one.


Code: [Select]
db accounts show root answer me :
Code: [Select]
root=system
    Gid=0
    Shell=/bin/bash
    Uid=0

instead of
Code: [Select]
root=system
    Gid=0
    Uid=0


i went there (http://wiki.contribs.org/DB_Variables_Configuration) but no real answer, just afraid to make another mistake.

Thx for answer

Offline mmccarn

  • *
  • 2,656
  • +10/-0
Re: Disable shell access to root
« Reply #1 on: May 22, 2011, 01:19:20 PM »
My SME 7.5.1 system shows:
Code: [Select]
db accounts show root
root=system
    Gid=0
    Uid=0

However, root is already using the bash shell:
Code: [Select]
grep ^root: /etc/passwd
root:x:0:0:root:/root:/bin/bash

You can delete the extra db variable using
Code: [Select]
db accounts delprop root Shellbut that won't change the shell that root is using.

Is there another problem?  What is the "regular one"?

Offline tetedekloo

  • *
  • 8
  • +0/-0
Re: Disable shell access to root
« Reply #2 on: May 22, 2011, 01:44:12 PM »
i mean by regular one
Code: [Select]
[root@xxx ~]#but i have
Code: [Select]
-bash-3.00#

Offline janet

  • *****
  • 4,812
  • +0/-0
Re: Disable shell access to root
« Reply #3 on: May 22, 2011, 04:17:37 PM »
tetedekloo

Please use google to search for basics

http://linux.die.net/man/1/chsh

http://linux.die.net/man/5/shells

# chsh
Changing shell for root.
New shell [/bin/bash]:

# db accounts show root
root=system
    Gid=0
    Uid=0

# cat /etc/shells
/bin/bash
/bin/bash2
/sbin/e-smith/console
/bin/csh
/bin/false
/usr/bin/rssh
/bin/sh
Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Disable shell access to root
« Reply #4 on: May 22, 2011, 06:35:00 PM »
I think you might have messed up your system more than you think. It seems your shell is OK, but some of the environmental variables that are set are gone. There might be more missing or corrupt under the covers.

Your symptoms seems to me that ~/.bashrc might be corrupt or gone. AFAICT the default one should look like this:

Code: [Select]
# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline tetedekloo

  • *
  • 8
  • +0/-0
Re: Disable shell access to root
« Reply #5 on: May 24, 2011, 03:46:35 PM »
thx Cactus, a step beyond.

I need to su root to get a regular bash, but how can avoid this step.
It looks like its a chsh command, but i do not figure how it woks. I know man, but sometime i cannot understand him...

thx for advices.