access jail via ssh

Status
Not open for further replies.

dirkme

Contributor
Joined
Jul 19, 2017
Messages
162
I googled around and tried some things, so far:

I started ssh with the jail shell with:
Code:
service sshd onestart
only because I have no idea how to access /etc/rc.conf. nano isn't
installed etc. however.

When i try to ssh into my jail, lets say:
Code:
ssh: root@192.168.1.5
I get asked for the root password but the system root password doesn't get accepted.

so, i just can't access the jail via ssh to install radarr and nzbget.

Help ;-)
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
SSH into you main system and then switch to the jail you want and install.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
nano isn't installed etc.
ee probably is, or you can always pkg install nano. But in any case, as @Jailer said, there's no need to ssh in to the jail. Just ssh in to the root account on your FreeNAS box, jls, find the number of the jail you want to access, jexec # tcsh.
 

dirkme

Contributor
Joined
Jul 19, 2017
Messages
162
SSH into you main system and then switch to the jail you want and install.

How do you switch to a jail?
ee probably is, or you can always pkg install nano. But in any case, as @Jailer said, there's no need to ssh in to the jail. Just ssh in to the root account on your FreeNAS box, jls, find the number of the jail you want to access, jexec # tcsh.

I changed root password with the jail shell, but still can't ssh into the jail, i am interested in the way to ssh as root and switch to jail
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
i am interested in the way to ssh as root and switch to jail
You just quoted me telling you exactly how to do this.
 

Mlovelace

Guru
Joined
Aug 19, 2014
Messages
1,111
I switched it on and can ssh to freenas. I also can ssh to the jail IP but root password is not accepted.
You seem to be missing the responses to your questions.
To ssh directly into the jail you need to allow root access via ssh in the jail. To do that you need to edit the /etc/ssh/sshd_config file and change the
Code:
PermitRootLogin
to YES. Also you need to edit the /etc/rc.conf file and change
Code:
service_sshd
to YES.
You want to change the rc.conf file so that ssh starts with the jail rather than having to start it manually every time.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
...or do what @dlavigne recommended, create a new user within the jail, and ssh in as that user. Then su to root as necessary.
 

dirkme

Contributor
Joined
Jul 19, 2017
Messages
162
You seem to be missing the responses to your questions.
To ssh directly into the jail you need to allow root access via ssh in the jail. To do that you need to edit the /etc/ssh/sshd_config file and change the
Code:
PermitRootLogin
to YES. Also you need to edit the /etc/rc.conf file and change
Code:
service_sshd
to YES.
You want to change the rc.conf file so that ssh starts with the jail rather than having to start it manually every time.

I did all of this in the jail and ssh is now working just fine, the root password still gets denied.
 

dirkme

Contributor
Joined
Jul 19, 2017
Messages
162
...or do what @dlavigne recommended, create a new user within the jail, and ssh in as that user. Then su to root as necessary.

I want to use midnight commander to ssh over to the jail and drop some files there. Is there a way to root to freenas and move files from there to the jail with midnight commander?
 

Mlovelace

Guru
Joined
Aug 19, 2014
Messages
1,111
I did all of this in the jail and ssh is now working just fine, the root password still gets denied.
Did you give the jail's root user a password? The freeNAS root user's password is not passed through to the jail's root user.
 

dirkme

Contributor
Joined
Jul 19, 2017
Messages
162
Did you give the jail's root user a password? The freeNAS root user's password is not passed through to the jail's root user.

Yes, I used
Code:
passwd root
added my password twice, but still doesn't get accepted at ssh.
 

Mlovelace

Guru
Joined
Aug 19, 2014
Messages
1,111
Yes, I used
Code:
passwd root
added my password twice, but still doesn't get accepted at ssh.
Okay, in the /etc/ssh/sshd_config file there is another line you may need to edit. PasswordAuthentication should say yes.
Code:
PasswordAuthentication yes
 

dirkme

Contributor
Joined
Jul 19, 2017
Messages
162
Okay, in the /etc/ssh/sshd_config file there is another line you may need to edit. PasswordAuthentication should say yes.
Code:
PasswordAuthentication yes

did it and still get this: Permission denied

Update: I installed in the jail MC and can now ssh into a different computer and pull my programs from there. At least i can get files into the jail. But i really do not understand (except it is a bug) why I can not ssh to the jail as root having all the settings right.
 
Last edited:

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
You can youre just not getting it right yet.
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
What are you using to SSH into the jail? EXACTLY what all changes did you make to the /etc/ssh/sshd_config file?
 

dirkme

Contributor
Joined
Jul 19, 2017
Messages
162
What are you using to SSH into the jail? EXACTLY what all changes did you make to the /etc/ssh/sshd_config file?

Can't do it tonight, but asap i have a few minutes I will type it down.

From memory:

changed root password

PasswordAuthentication="yes"

PermitRootLogin="yes"

service_sshd="yes"

That should cover it, but i make sure it is all set as I wrote it.
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
Did you un comment the lines you modified? You have to remove the pound sign # at the beginning of the line to un comment it and make it active.
 
Status
Not open for further replies.
Top