Signed-off-by: Mikle Kolyada gentoo.org Package-Manager: Portage-2.3.51, Repoman-2.3.11 dev-ruby/net-ssh: keyworded 5.0.2 for ppc, bug #667070 Sergei Trofimovich. Sshconnection=10.111.222.104 51682 10.111.222.23 22 I remember reading some stuff regarding the black-magic of /dev/tty - which (please correct me if i am wrong) always points to the used terminal like /dev/pts/0 - and thats it. Soda pdf.
Contents
Before you read
There is also full automated script available that can be executed on the host OS (works well for macOS and Linux, but could be tricky on Windows): https://github.com/sormy/gentoo-vbox-builder.
gentoo-vbox-builder doesn’t require any manual typing in VirtualBox console or any manipulations inside VirtualBox as the script referenced below.
However, the script below is easier and should work for any host OS since the script is executed inside guest.
Why?
Sometimes working Gentoo environment could be needed just right now but typical manual installation is taking time.
Gentoo Ssh Connection Refused
Let’s say you need Gentoo running on Virtual Box on your physical box to test some Gentoo-specific things or just to play with Gentoo Linux.
The script in this article will save your time since it is doing basic Gentoo installation steps to get minimal bootable Gentoo instance. It is a little bit naive and straightforward but it is also simple and easy to tune for your needs. Pretty linear bash script that is intended to be executed in guest OS.
How it works
It performs minimal set of actions to get bootable Gentoo: Cisco anyconnect win10.
- Prepare partitions (boot, swap, root partitions).
- Install latest stage3 and portage snapshot (for x86_64 platform, but that could be altered in script).
- Install bootloader.
- Install kernel:
- quick mode: Copy precompiled kernel from install CD.
- or regular mode: Download kernel sources and build kernel using genkernel.
- Setup dhcp wired network on first interface.
- Enable ssh.
- Install access credentials:
- Public SSH key for password-less ssh access.
- Root password for password-enabled ssh or regular terminal login access.
NOTE: All other options like locale, charset, hostname are default. You could login into host and change if you want.
Prerequisites
Instruction below should work for both macOS and Windows.
- Install VirtualBox
- Create new instance (around 15GB is needed for minimal Gentoo)
- (optional) Setup port forwarding from host to guest for SSH (for example, host 2222 -> guest 22)
- Download minimal installation CD iso: https://www.gentoo.org/downloads/
- Attach installation CD to instance
- Boot from installation CD
If you would like to enable SSH public key access:
- Put your ssh public key somewhere where Virtual Box instance can download it.
- For example, run
python3 -m http.server 8888 --directory ~/.ssh
on the host. - Download public key from guest later as
wget http://10.0.2.2:8888/id_rsa.pub
(or whatever public key you have)
Installation
THIS SCRIPT WILL DESTROY ALL DATA ON GUEST OS DISK!!! DO NOT RUN ON HOST OS WITH YOUR DATA!!!
- Setup credentials to access Gentoo after installation
- Download ssh public key if needed, for example:
wget http://10.0.2.2:8888/id_rsa.pub
- Export ssh public key if needed, for example:
export SSH_PUBLIC_KEY='$(cat id_rsa.pub)'
- Pick any secure password that can be accepted by Gentoo (keep in mind, password should be kind of secure – at least 8 characters, mix of upper and lower case and digits)
- Export root password if needed, for example:
export ROOT_PASSWORD='Gentoo123'
- Download ssh public key if needed, for example:
- (optional) Configure other environment variables:
- USE_LIVECD_KERNEL – it is up to you, using binary precompiled version is a faster way to get bootable Gentoo (enabled by default).
- Download Gentoo installer:
wget https://raw.githubusercontent.com/sormy/gentoo-quick-installer/mainline/gentoo-quick-installer.sh
- If you don’t want to type this URL, you could connect to guest using SSH
- Run ssh daemon on guest:
/etc/init.d/sshd start
- Change root password on guest:
passwd
- Connect using ssh from host to guest:
ssh -p root@localhost -p 2222
- Run the script:
bash gentoo-quick-installer.sh
- After installation script will try to eject installation CD and will initiate reboot.
- After reboot you should get Gentoo login prompt. If it did not happen, ensure that installation CD is ejected.
Script will stop if any error will happen.
Related posts:
The thing that bothers me is, that still the password request appears, although the password is not accepted:
Quote: |
$ ssh root@hostname Password: |
In the same setup on ubuntu server (1:5.3p1-3ubuntu4) I get this message:
Quote: |
$ ssh root@hostname Permission denied (publickey). |
Gentoo Ssh Root
[I] net-misc/openssh
Available versions: 5.2_p1-r3 5.3_p1-r1 ~5.4_p1-r2 ~5.5_p1-r1 {X X509 hpn kerberos ldap libedit pam pkcs11 selinux skey smartcard static tcpd}
Installed versions: 5.3_p1-r1(02:14:55 06/10/10)(ldap pam -X -X509 -hpn -kerberos -libedit -pkcs11 -selinux -skey -smartcard -static -tcpd)
Homepage: http://www.openssh.org/
Description: Port of OpenBSD's free SSH release
profile:
default/linux/amd64/10.0/server
The sshd_config file:
Code: |
ListenAddress xx.xx.xx.xx Protocol 2 ServerKeyBits 2048 PermitRootLogin no UsePAM yes PrintMotd no PrintLastLog no Subsystem sftp /usr/lib64/misc/sftp-server AllowGroups wheel DenyUsers root PasswordAuthentication no Match User extadmin PasswordAuthentication yes |
Ssh With Different Username
_________________
Optimism is solely an absence of information. / Optimismus ist nur ein Mangel an Information.
(Arthur Schopenhauer)