Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...Your site is a great idea. I should have joined your site years ago. Better late than never..."

Geography

Where in the world do Tek-Tips members come from?

Logging in as root via SSH when using chrootHelpful Member!(2) 

bazil2 (TechnicalUser)
1 Aug 12 17:29
(Elementary User)

In order to use chroot, I followed the following steps from the RHL knowledgebase:


# adduser jack

# mkdir /chroot
Create user's home directory, which will be actually '/' directory after user login.

# mkdir -p /chroot/home/jack
Copy all the files that the user needs including basic commands like 'ls', libraries and /dev files.

# mkdir /chroot/home/jack/bin
# cp -a /bin/bash /chroot/home/jack/bin/.
# cp -a /bin/ls /chroot/home/jack/bin/.
# cp -a /lib64 /chroot/home/jack/.
Edit /etc/ssh/sshd_config file

ChrootDirectory /chroot/%h
Restart sshd

# service sshd restart
# chkconfig sshd on

After undertaking this, the user jack was jailed as intended, however, can anyone please advise the correct procedure for being able to login as root?

Can anyone please advise, is there a way of switching to the user root or must one also create (like jack) a root folder in chroot?

Best regards


Noway2 (Programmer)
2 Aug 12 9:05

Quote:

After undertaking this, the user jack was jailed as intended, however, can anyone please advise the correct procedure for being able to login as root?

Can anyone please advise, is there a way of switching to the user root or must one also create (like jack) a root folder in chroot?
Why would you want to login to SSH as root? This is not a safe practice, even in a CHROOT jail (which can be broken). It would be much better for you to use either SU or SUDO to assume root privilege after you login as a non privileged user.
bazil2 (TechnicalUser)
2 Aug 12 9:13
Many thanks,

Could you please advise as to how I could enable the user 'jack' to be able to use SU or SUDO

Many thanks
Helpful Member!(2)  Noway2 (Programmer)
2 Aug 12 15:29
There is a sudo users file, /etc/sudoers. You don't want to try to edit this file directly, though. Instead use the command visudo. You will need to add the user jack to the sudoer's file and give them appropriate permissions, typically ALL, but you have the option of using refined control.

The Ubuntu wiki page has about the best how-to on the subject I've seen. Sudo is generic and this should work on any distribution. Here is a link: http://ubuntuforums.org/showthread.php?t=1132821

Once you have done this, when operating as Jack, you can prefix a privileged command with sudo, you will be prompted for JACK'S password.
To bring up a root level prompt without having to prefix every command you can then use 'sudo -i', with JACK's password.

Otherwise, if you have a root account you can use use 'su -' to switch to user root, and use the ROOT password.



Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close