| View previous topic :: View next topic |
| Author |
Message |
Joseph_sys Advocate

Joined: 08 Jun 2004 Posts: 2316 Location: Edmonton, AB
|
Posted: Mon Apr 23, 2012 1:46 am Post subject: [SOLVED] ssh to root when in bootstrap |
|
|
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 |
|
 |
EatMeerkats Apprentice


Joined: 15 Mar 2006 Posts: 234
|
Posted: Mon Apr 23, 2012 2:06 am Post subject: |
|
|
| Did you set the root password with "passwd" and start sshd with "/etc/init.d/sshd start"? |
|
| Back to top |
|
 |
Joseph_sys Advocate

Joined: 08 Jun 2004 Posts: 2316 Location: Edmonton, AB
|
Posted: Mon Apr 23, 2012 2:25 am Post subject: |
|
|
| 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 |
|
 |
EatMeerkats Apprentice


Joined: 15 Mar 2006 Posts: 234
|
Posted: Mon Apr 23, 2012 2:37 am Post subject: |
|
|
| 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 |
|
 |
Joseph_sys Advocate

Joined: 08 Jun 2004 Posts: 2316 Location: Edmonton, AB
|
Posted: Mon Apr 23, 2012 3:12 am Post subject: |
|
|
| 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 |
|
 |
BillWho Veteran


Joined: 03 Mar 2012 Posts: 1587 Location: US
|
Posted: Mon Apr 23, 2012 3:42 am Post subject: |
|
|
Joseph_sys.
Try this after mount -t proc none /mnt/gentoo/proc
| Code: | | mount -o bind /dev /mnt/gentoo/dev |
_________________ Good luck
Since installing gentoo, my life has become one long emerge  |
|
| Back to top |
|
 |
Joseph_sys Advocate

Joined: 08 Jun 2004 Posts: 2316 Location: Edmonton, AB
|
Posted: Mon Apr 23, 2012 5:05 am Post subject: |
|
|
| 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 |
|
 |
EatMeerkats Apprentice


Joined: 15 Mar 2006 Posts: 234
|
Posted: Mon Apr 23, 2012 12:19 pm Post subject: |
|
|
| You need to use "mount --rbind /dev /mnt/gentoo/dev" so /dev/pts also gets mounted. |
|
| Back to top |
|
 |
Joseph_sys Advocate

Joined: 08 Jun 2004 Posts: 2316 Location: Edmonton, AB
|
Posted: Mon Apr 23, 2012 4:22 pm Post subject: |
|
|
| 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 |
|
 |
EatMeerkats Apprentice


Joined: 15 Mar 2006 Posts: 234
|
Posted: Mon Apr 23, 2012 4:50 pm Post subject: |
|
|
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 |
|
 |
Joseph_sys Advocate

Joined: 08 Jun 2004 Posts: 2316 Location: Edmonton, AB
|
Posted: Mon Apr 23, 2012 4:59 pm Post subject: |
|
|
| 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 |
|
 |
|