Page 1 of 1

[HOWTO] Log in a jail using his name

Posted: 23 Jan 2013 14:53
by raulfg3

Re: [HOWTO] Log in a jail using his name

Posted: 23 Jan 2013 17:40
by alexey123
Good working idea!
But better way - create into jail SSH server and log into without nas4free host.

Re: [HOWTO] Log in a jail using his name

Posted: 23 Jan 2013 18:18
by raulfg3
alexey123 wrote:But better way - create into jail SSH server and log into without nas4free host
Do you mean somethig like this:

How Do I Login Remotely (Directly) To Jail?
First, login using jexec command. Add the following line to jail /etc/rc.conf:
# echo 'sshd_enable="YES"' >> /etc/rc.conf
Open sshd_config file and update listen parameter to bind to jail IP only. Start OpenSSH server inside the jail:
# /etc/rc.d/sshd start
# sockstat -4
extract from : http://www.cyberciti.biz/faq/howto-setu ... th-ezjail/

Re: [HOWTO] Log in a jail using his name

Posted: 24 Jan 2013 00:24
by alexey123
In first, you must go to Services|SSH webgui and add to Extra options ListenAddress <your_nas _ip>
Image

In second create user for jail from nas4free host

Code: Select all

jexec 1 adduser
System will ask questions, for example:
Username:
Full name:
Uid (Leave empty for default):
Login group []: wheel
Login group is wheel. Invite alexey into other groups? []:
Login class [default]:
Shell (sh csh tcsh nologin) [sh]: csh
Home directory []:
Home directory permissions (Leave empty for default):
Use password-based authentication? [yes]: yes
Use an empty password? (yes/no) [no]:
Use a random password? (yes/no) [no]:
Enter password:
Enter password again:
Lock out the account after creation? [no]:
Username :
Password : *****
Full Name :
Uid : 1001
Class :
Groups : wheel
Home :
Home Mode :
Shell : /bin/csh
Locked : no
OK? (yes/no): yes
adduser: INFO: Successfully added () to the user database.
Add another user? (yes/no): no
Goodbye!
After this see for example /var/etc/ssh/sshd_config and edit jail's /etc/ssh/sshd_config with some directives. But minor - under jail your root not have password, I define

Code: Select all

PermitRootLogin no

After edit config need add sshd_enable="YES" to /etc/rc.conf and start server

Code: Select all

/etc/rc.d/sshd start
You can switch user with su, and check whith whoami command