Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the method that only allows SSH accounts to surf the Internet?

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

What is the method of only allowing SSH accounts to surf the Internet? in view of this question, this article introduces in detail the corresponding analysis and solutions, hoping to help more partners who want to solve this problem to find a more simple and feasible way.

Create user groups, create users, set passwords:

The code is as follows:

Groupadd SSHTunnel

Useradd-g SSHTunnel-s / bin/bash-d / home/tunnel TunnelUser1

Passwd TunnelUser1

Set sftp permissions:

The code is as follows:

Chmod 700 / usr/lib/openssh/sftp-server

Add in / etc/ssh/sshd_config:

The code is as follows:

Match Group SSHTunnel

AllowTcpForwarding yes

ForceCommand sh / home/tunnel/tunnelshell.sh

Download the settings login script:

The code is as follows:

Wget https://chencp.info/tunnelshell.sh-- no-check-certificate-O / home/tunnel/tunnelshell.sh

Ln-s / home/tunnel/tunnelshell.sh / home/tunnel/.profile

Finally restart sshd:

The code is as follows:

/ etc/init.d/ssh restart

This is fine, and the user also supports the passwd command to change the password after logging in.

If you add users, then:

The code is as follows:

Useradd-g SSHTunnel-s / bin/bash-d / home/tunnel

Passwd

The answer to the question about what the SSH account is only allowed to surf the Internet is shared here. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report