Koozali.org: home of the SME Server

Obsolete Releases => SME Server 7.x => Topic started by: tetedekloo on May 22, 2011, 11:58:55 AM

Title: Disable shell access to root
Post by: tetedekloo 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
Title: Re: Disable shell access to root
Post by: mmccarn 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"?
Title: Re: Disable shell access to root
Post by: tetedekloo 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#
Title: Re: Disable shell access to root
Post by: janet 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
Title: Re: Disable shell access to root
Post by: cactus 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
Title: Re: Disable shell access to root
Post by: tetedekloo 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.