Using the lshell+ script to implement the Fortress machine (jump connection) function

Source: Internet
Author: User
Tags git clone

Fortress Machine (jump connection) function:

Users who need to log on to the production server must first log on to this server and then log on to the production server from this server.

You can limit the use of SSH and exit commands, or write a script yourself to let the person who is logged in choose.


Here you can install the Lshell on the bastion machine (jump Connect) server to achieve various restrictions.


1. Installing Lshell Tools
GIF home: Https://github.com/ghantoos/lshell

If the bastion machine is not networked, you can download the installation files from somewhere else and copy them over.

git clone https://github.com/ghantoos/lshell.git
CD Lshell
Python setup.py install–no-compile–install-scripts=/usr/bin/

If there is no error, the installation is successful.

2, Configuration conf
Configure this file, you can achieve a good result.
Vim/etc/lshell.conf

[Default]

Allowed: [' ssh ', ' exit ']


3, change user default shell, use Lshell as default shell:
# cp/etc/lshell.conf/usr/local/etc/
# chsh-s/usr/bin/lshell user_ Name This command can only modify a user, you can write a script to bulk modify the

4. Open log
To record the user log, you need to create the relevant directory
# Addgroup–system Lshell
# Mkdir/var/log/lshell
# Chown:lshell/var/log/lshell
# chmod 770/var/log/lshell

Then add the user to the Lshell group:
# Usermod-ag Lshell user_name

# More articles See my personal site: haibing.org #

Using the lshell+ script to implement the Fortress machine (jump connection) function

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.