Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] ssh to root when in bootstrap
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
Joseph_sys
Advocate
Advocate


Joined: 08 Jun 2004
Posts: 2316
Location: Edmonton, AB

PostPosted: Mon Apr 23, 2012 1:46 am    Post subject: [SOLVED] ssh to root when in bootstrap Reply with quote

I bootstrap one of my boxes and running it in changeroot environment.
How to I ssh to root?

I've change in ssh/sshd_config "permit root login: yes"
it keep asking me for password but it does not recognize the password.
_________________
#Joseph


Last edited by Joseph_sys on Mon Apr 23, 2012 4:22 pm; edited 1 time in total
Back to top
View user's profile Send private message
EatMeerkats
Apprentice
Apprentice


Joined: 15 Mar 2006
Posts: 234

PostPosted: Mon Apr 23, 2012 2:06 am    Post subject: Reply with quote

Did you set the root password with "passwd" and start sshd with "/etc/init.d/sshd start"?
Back to top
View user's profile Send private message
Joseph_sys
Advocate
Advocate


Joined: 08 Jun 2004
Posts: 2316
Location: Edmonton, AB

PostPosted: Mon Apr 23, 2012 2:25 am    Post subject: Reply with quote

EatMeerkats wrote:
Did you set the root password with "passwd" and start sshd with "/etc/init.d/sshd start"?


Yes, I did:
Code:
ssh root@10.0.0.161
Password:
PTY allocation request failed on channel 0

_________________
#Joseph
Back to top
View user's profile Send private message
EatMeerkats
Apprentice
Apprentice


Joined: 15 Mar 2006
Posts: 234

PostPosted: Mon Apr 23, 2012 2:37 am    Post subject: Reply with quote

Hmm, sounds like /dev isn't mounted in the chroot… did you do something like "mount --rbind /dev /mnt/gentoo/dev" before you chrooted?
Back to top
View user's profile Send private message
Joseph_sys
Advocate
Advocate


Joined: 08 Jun 2004
Posts: 2316
Location: Edmonton, AB

PostPosted: Mon Apr 23, 2012 3:12 am    Post subject: Reply with quote

EatMeerkats wrote:
Hmm, sounds like /dev isn't mounted in the chroot… did you do something like "mount --rbind /dev /mnt/gentoo/dev" before you chrooted?


I was following my notes when doing bootstrap:
Code:
boot strap gentoo liveCD (bootstrap)

# swapon /dev/sda2
# mount -t ext3 /dev/sda3 /mnt/gentoo
# mount /dev/sda1 /mnt/gentoo/boot
# cd /mnt/gentoo
# mount -t proc none /mnt/gentoo/proc
# chroot /mnt/gentoo /bin/bash
# env-update
# source /etc/profile

_________________
#Joseph
Back to top
View user's profile Send private message
BillWho
Veteran
Veteran


Joined: 03 Mar 2012
Posts: 1587
Location: US

PostPosted: Mon Apr 23, 2012 3:42 am    Post subject: Reply with quote

Joseph_sys.

Try this after mount -t proc none /mnt/gentoo/proc
Code:
mount -o bind /dev /mnt/gentoo/dev

_________________
Good luck :wink:

Since installing gentoo, my life has become one long emerge :)
Back to top
View user's profile Send private message
Joseph_sys
Advocate
Advocate


Joined: 08 Jun 2004
Posts: 2316
Location: Edmonton, AB

PostPosted: Mon Apr 23, 2012 5:05 am    Post subject: Reply with quote

BillWho wrote:
Joseph_sys.

Try this after mount -t proc none /mnt/gentoo/proc
Code:
mount -o bind /dev /mnt/gentoo/dev


it doesn't help :-/ still getting this:
Code:

PTY allocation request failed on channel 0

_________________
#Joseph
Back to top
View user's profile Send private message
EatMeerkats
Apprentice
Apprentice


Joined: 15 Mar 2006
Posts: 234

PostPosted: Mon Apr 23, 2012 12:19 pm    Post subject: Reply with quote

You need to use "mount --rbind /dev /mnt/gentoo/dev" so /dev/pts also gets mounted.
Back to top
View user's profile Send private message
Joseph_sys
Advocate
Advocate


Joined: 08 Jun 2004
Posts: 2316
Location: Edmonton, AB

PostPosted: Mon Apr 23, 2012 4:22 pm    Post subject: Reply with quote

EatMeerkats wrote:
You need to use "mount --rbind /dev /mnt/gentoo/dev" so /dev/pts also gets mounted.


Thank you, that was it!
So correct procedure for boot strap would be:
Code:
# swapon /dev/sda2
# mount -t ext3 /dev/sda3 /mnt/gentoo
# mount /dev/sda1 /mnt/gentoo/boot
# cd /mnt/gentoo
# mount -t proc none /mnt/gentoo/proc
# mount -o bind /dev /mnt/gentoo/dev  (needed for ssh login)
# mount --rbind /dev /mnt/gentoo/dev (needed for ssh login)
# chroot /mnt/gentoo /bin/bash
# env-update
# source /etc/profile

_________________
#Joseph
Back to top
View user's profile Send private message
EatMeerkats
Apprentice
Apprentice


Joined: 15 Mar 2006
Posts: 234

PostPosted: Mon Apr 23, 2012 4:50 pm    Post subject: Reply with quote

Glad you got it working! One quick note, though: "mount --rbind /dev /mnt/gentoo/dev" mounts /dev and its children, so you can skip the first "mount -o bind /dev /mnt/gentoo/dev". :)
Back to top
View user's profile Send private message
Joseph_sys
Advocate
Advocate


Joined: 08 Jun 2004
Posts: 2316
Location: Edmonton, AB

PostPosted: Mon Apr 23, 2012 4:59 pm    Post subject: Reply with quote

EatMeerkats wrote:
Glad you got it working! One quick note, though: "mount --rbind /dev /mnt/gentoo/dev" mounts /dev and its children, so you can skip the first "mount -o bind /dev /mnt/gentoo/dev". :)


Noted, Thank you again.
_________________
#Joseph
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