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

How to restrict user accounts connected remotely through the SSH Ubuntu command

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article is about how to restrict user accounts that connect remotely through the SSH Ubuntu command. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Ubuntu command, if you enable the SSH service, then any user with a valid account can connect remotely. This may cause some security problems, because there are some remote password cracking tools that can try the configuration file sudo cp / etc/ssh/sshd_config / etc/ssh/sshd_config.ORIGINAL of the common username / password backup SSH service.

Edit configuration file

Sudo gedit / etc/ssh/sshd_config

Change the parameter PermitRootLogin from yes to no. Superusers cannot go online directly via remote access.

Add the parameter AllowUsers to set the user name of the remote connection (separated by spaces).

You can also use DenyUsers for fine-grained selection of users.

If you enable the openssh server and you have no intention for now to enable remote connections, you may add AllowUsers nosuchuserhere to disable anyone connecting.

SSH Ubuntu command

The ssh Ubuntu command can be used to execute a Ubuntu command on a remote machine without being prompted to log in by shell. Its syntax format is: ssh hostname command. For example, if you want to execute the ls / usr/share/doc Ubuntu command on the remote host penguin.example.net, type the following Ubuntu command at the shell prompt:

Ssh penguin.example.net ls / usr/share/doc

Use the scp Ubuntu command

The scp Ubuntu command can be used to transfer files between machines over a secure, encrypted connection. It is similar to rcp.

The general syntax for transferring local files to a remote system is:

Scp localfile username@tohostname:/newfilename

Localfile specifies the source file, and username@tohostname:/newfilename specifies the destination file. To transfer the local file shadowman to your account on penguin.example.net, type at the shell prompt (replace username with your user name):

Scp shadowman username@penguin.example.net:/home/username

This transfers the local file shadowman to the / home/username/shadowman file on penguin.example.net.

The general syntax for transferring remote files to the local system is:

Scp username@tohostname:/remotefile / newlocalfile

Remotefile specifies the source file, and newlocalfile specifies the destination file.

The source file can be made up of multiple files. For example, to transfer the contents of the directory / downloads to the existing uploads directory on the remote machine penguin.example.net, type the following Ubuntu command at the shell prompt:

Scp / downloads/* username@penguin.example.net:/uploads/

Use the sftp Ubuntu command

The sftp tool can be used to open a secure interactive FTP session. It is similar to ftp, except that it uses secure, encrypted connections. Its general syntax is: sftp username@hostname.com. Once verified, you can use a set of Ubuntu commands similar to using FTP.

Thank you for reading! This is the end of the article on "how to restrict user accounts connected remotely through SSH Ubuntu commands". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!

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