xp底下成功使用ssh登录ubuntu linux(采用密钥方式)
服务器端的设置:
安装ssh:
sudo apt-get install ssh
以普通用户的身份建立公钥和私钥:
ssh-keygen -t rsa
然后要求你确认钥匙的文件名(用默认的就好了);输入口令;再次输入口令。
在~/.ssh/下会生成公钥id_rsa.pub和私钥id_rsa
更改公钥文件名:
cd ~/.ssh/
mv id_rsa.pub authorized_keys
设置文件属性:
chmod 400 authorized_keys
chmod 644 id_rsa
备份SSH服务的配置文件
sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.ORIGINAL
编辑配置文件
sudo gedit /etc/ssh/sshd_config
这是我的配置文件,重点部分我会用红色字体,注释用蓝色字体
# Package generated configuration file
# See the sshd(8) manpage for details
# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes
# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 1024 //将ServerKey强度改为1024比特
# Logging
SyslogFacility AUTH
LogLevel INFO
# Authentication:
LoginGraceTime 120
PermitRootLogin no //禁止以root登录
StrictModes no //关闭严格登录
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile /home/yourusername/.ssh/authorized_keys //这里是指定你公匙所在的位置,yourusername用你的用户名代替。
# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes
# To enable empty passwords, change to yes
相关文档:
感谢原文作者:http://blog.csdn.net/thinkerABC/archive/2006/03/11/621817.aspx
感谢转帖者的排版:http://blog.chinaunix.net/u3/101219/showart_2006014.html
我们通常把一些公用函数
制作成函数库,供其它程序使用。
函数库分为静态库和动态库两种。
静态库在程序编译时会被连接到目标代码中, ......
int Daemon(char* szExecName = NULL)
{
int res = 0;
pid_t pc;
pc = fork();
if(pc < 0)
{
fprintf(stderr,"ERROR_Deamon()_fork(): failed!");
return -1;
}
else if(pc == 0) //sub process
{
}
else if( ......
Ubuntu Linux系统开启TELNET服务的方法
RSS订阅,第一时间获取开源资讯动态
1. sudo apt-get install xinetd telnetd
2. 安装成功后,系统也会有相应提示(好象7.10才有,6.10就没看到)
sudo vi /etc/inetd.conf并加入以下一行
telnet stream tcp nowait telnetd /usr/sbin/tcpd /usr/sbin/in.tel ......