Linux客户端使用SSH的命令管理linux服务器
<!--
@page { margin: 2cm }
P { margin-bottom: 0.21cm }
TD P { margin-bottom: 0cm }
A:link { so-language: zxx }
-->
登陆:ssh [hostname]
输入密码:*****
登
陆以后就可以像控制自己的机器一样控制它了,不过没有可视化的界面。不过现在
我所使用过的两个版本Linux(SUSE
和FC5)
中有可以使用类似FTP
界面的工具。使用工具连接时,选择SSH
,端口是填服务器的SSH
端口,默认是22
,但是还是要手工填写。连接上以后FTP
界面和shell
同时使用可以
提高工作效率。
# visudo
%wheel ALL=(ALL) ALL
# gpasswd -a user1 wheel
4)
限制 ssh
使用者名单
# vi /etc/pam.d/sshd
auth required
pam_listfile.so item=user sense=allow file=/etc/ssh_users ōnerr=fail
# echo user1 >>
/etc/ssh_users
5)
封锁 ssh
联机并改用 web
控管清单
# iptables -I INPUT -p tcp
--dport 22 -j DROP
# mkdir
/var/www/html/ssh_open
# cat >
/var/www/html/ssh_open/.htaccess < AuthName "ssh_open"
AuthUserFile
/var/www/html/ssh_open/.htpasswd
AuthType basic
require valid-user
END
# htpasswd -c
/var/www/html/ssh_open/.htpasswd user1
(
最好还将 SSL
设起来,
或只限
https
联机更佳,
我这里略过 SSL
设定,
请读者自补.)
(
如需控制联机来源,
那请再补 Allow/Deny
项目,
也请读者自补.)
# cat >
/var/www/html/ssh_open/ssh_open.php < //Set dir path for ip list
$dir_path=".";
//Set filename for ip list
$ip_list="ssh_open.txt";
//Get client ip
$user_ip=$_SERVER['REMOTE_ADDR'];
//allow specifying ip if
needed
if (@$_GET['myip']) {
$user_ip=$_GET['myip'];
}
//checking IP format
if
($user_ip==long2ip(ip2long($user_ip))) {
//Put client ip to a file
if(@!($file =
fopen("$dir_path/$ip_list","w+")))
{
echo "Permission
denied!!
";
echo "Pls Check your
rights to dir $dir_path or file $ip_list";
}
else
{
fputs($file,"$user_ip");
fclose($file);
echo "client
ip($user_ip) has put into $dir_path/$ip_list&quo
相关文档:
总览
用iptables -ADC 来指定链的规
则
,-A添加 -D删除 -C 修改
iptables - [RI] chain rule num rule-specification[option]
用iptables - RI 通过规则的顺序指定
iptables -D chain rule num[option]
删除指定规则
iptables -[LFZ] [chain][option]
用iptables -LFZ 链名 [选项]
iptables -[NX] chain
用 -NX ......
2009 年 4 月 23 日
本文中我们针对 Linux 上多线程编程的主要特性总结出 5 条经验,用以改善 Linux 多线程编程的习惯和避免其中的开发陷阱。在本文中,我们穿插一些 Windows 的编程用例用以对比 Linux 特性,以加深读者印象。
背景
Linux 平台上的多线程程序开发相对应其他平台(比如 Windows)的多线程 API 有一些细微 ......
tar 文件是几个文件和(或)目录在一个文件中的集合。这是创建备份和归档的佳径。
tar 使用的选项有:
-c — 创建一个新归档。
-f — 当与 -c 选项一起使用时,创建的 tar 文件使用该选项指定的文件名;当与 -x 选项一起使用时,则解除该选项指定的归档。
-t — 显示包括在 tar 文件中的文件列表。
-v ......
1 shutdown:
[NAME
] shutdown - bring the system down
SYNOPSIS
/sbin/shutdown [-t sec] [-arkhncfF] time [warning-message]
DESCRIPTION
shutdown brings the system down in a secure way.&nb ......