91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

限制 ssh 從某些 IP 登錄( authorized_keys )

發布時間:2020-08-10 23:09:12 來源:ITPUB博客 閱讀:225 作者:perfychi 欄目:建站服務器

Restricting SSH logins to particular IP addresses

Posted by Steve on Mon 28 Jan 2013 at 23:37

Tags: openssh, ssh

Many people use SSH keys for password-less logins, and the increase in security that keys provide over (traditionally weaker) passwords. But few people seem to realize that you can also restrict logins to known-good IP addresses, via that same mechanism.

It has to be said that if you've got root access upon a server one way to restrict people connecting to your machine is to use a firewall. The venerable iptables firewall primitive makes this easy.

However you can usefully use IP address restrictions even in combination with a firewall, for example you might wish to allow your users to login from within your network, but only allow an auto-build user to login from a remote jenkins server - to clone some source code, for example.

The basic mechanism is straight-forward enough, rather than just storing the public-part of a key to your users ~/.ssh/authorized_keys file you also store some configuration entries.

To restrict the user bob to remote logins from the single IP address 1.2.3.4 you would use this in the ~bob/.ssh/authorized_keys file:

from="1.2.3.4" ssh-rsa  ....

Here we've added the "from="1.2.3.4"" section, prior to the key for the user. This is just one of the options you can add, and the quoted value is a list of comma-separated hosts from which the login will be allowed.

If you wished to allow logins from several sources you could use something like this:

from="1.2.3.0/24,44.55.66.77" ssh-rsa ...

In addition to the IP-address restrictions you can configure several other things, such as denying the use of agent-forwarding, denying the use of port-forwards, & etc.

The other options are comma-separated too, and are documented in the manpage for sshd, under the section "AUTHORIZED_KEYS FILE FORMAT". As a good example of a secure login this is a good start:

from="1.2.3.4",no-agent-forwarding,no-port-forwarding,no-X11-forwarding ssh-rsa ...

This disables the use of agent-forwarding, port-forwarding, etc. whilst still allowing interactive logins. If you were using SSH for special-purpose logins you could restrict things further, by denying interactive login-shells and forcing the execution of a particular command:

command="/usr/local/bin/my-prog" ssh-rsa ..

This is useful for remote backups carried out via rsync + ssh, as it can ensure that your remote user can only execute the expected command - and not anything else.

Add Comment 限制 ssh 從某些 IP 登錄( authorized_keys )
向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

哈巴河县| 探索| 邛崃市| 涿鹿县| 汝南县| 万宁市| 左云县| 牡丹江市| 清徐县| 司法| 新干县| 北辰区| 铅山县| 沁水县| 梁山县| 湖州市| 江永县| 漳州市| 洪湖市| 禄丰县| 灵丘县| 友谊县| 潜江市| 固安县| 潞城市| 金平| 彰武县| 梓潼县| 淳化县| 澄江县| 共和县| 昭觉县| 洛宁县| 常熟市| 蓝田县| 会东县| 繁峙县| 长顺县| 五莲县| 西青区| 获嘉县|