关闭Linux传统SSH密码登录与开启密钥登录

1、用winscp,将id_rsa.pub文件上传到/root/.ssh/下面(如果没有则创建此目录),并重命名为:authorized_keys(如果是在Linux服务器上生成的密钥直接执行:mv /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys),再执行:chmod 600 /root/.ssh/authorized_keys 修改权限。

2、修改/etc/ssh/sshd_config 文件,将RSAAuthentication 和 PubkeyAuthentication 后面的值都改成yes ,保存。

3、重启sshd服务,Debian/Ubuntu执行/etc/init.d/ssh restart ;CentOS执行:/etc/init.d/sshd restart

4、如果验证成功的话就可以关闭密码登陆方式了,编辑/etc/ssh/sshd_config,将PasswordAuthentication改为no,ChallengeResponseAuthentication改为no,不过需要重启sshd(service sshd restart)后才能生效。

 

————————————————–

参考资料:
http://www.vpser.net/security/linux-ssh-authorized-keys-login.html
http://www.cnblogs.com/tintin1926/archive/2012/07/23/2604281.html

双系统下grub的相关设置

我的电脑是装了两个系统,一个是 win8.1,另一个是 ubuntu 14.04。默认情况下,每次开机时,电脑会显示grub菜单等待30秒,默认是选中ubuntu的,这个太浪费时间了。

查了一下资料,原来通过设置可以将grub设置为每次默认选中上次进入的系统,而且还可以设定等待时间。

  1. 首先在终端输入命令:sudo gedit /etc/default/grub
  2. 然后修改其内如下,我在下面贴出了文件中的前面几行,后面的都没动,其实后面也都是注释而已。
  3. 最后还要运行 sudo update-grub 命令,提交本次修改的设置。

/etc/default/grub

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'

GRUB_DEFAULT=saved  # 每次默认的系统是上次进入的系统
GRUB_SAVEDEFAULT=true # 上面设置了 saved 值,就要写上这句
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=3 # 默认等待的时间设为 3 秒,可以根据自己的习惯调整
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

 

偶然发现这个文件ubuntu-logo.grub,可以直接修改grub背景颜色

修改Grub背景颜色

sudo gedit /lib/plymouth/themes/ubuntu-logo/ubuntu-logo.grub
#原来的紫色
#if background_color 44,0,30; then
#  clear
#fi#改成黑色
if background_color 0,0,0; then
clear
fi
#链接关系:
#/etc/alternatives/default.plymouth.grub /lib/plymouth/themes/ubuntu-logo/ubuntu-logo.grub
#/lib/plymouth/themes/default.grub /etc/alternatives/default.plymouth.grub

———————-

参考资料:

http://blog.csdn.net/zhang_hui_cs/article/details/8570253

http://www.xuebuyuan.com/1945828.html

CentOS6零基础配置shadowsocks服务端完整教程

shadowsocks 是一个轻量级隧道 socks5 代理,可加密网络通道。
项目主页:https://github.com/clowwindy/shadowsocks
官方wiki:https://github.com/clowwindy/shadowsocks/wiki/Shadowsocks

说明:
此教程为官方wiki补充,并附带M2Crypto、gevent 安装的详细说明,以便于零基础用户配置 shadowsocks 服务端。
此处以云睿数据(http://cloreal.net)的廉价VPS举例…
系统 CentOS6.5 x86_64,内建Python版本2.6.6(可使用 python -V 命令查看)

准备工作:安装所需组件

yum install wget tar gcc gcc-c++ openssl openssl-devel pcre-devel python-devel libevent -y

一、升级python
1、按以下步骤执行

cd /root
wget http://www.python.org/ftp/python/2.7.6/Python-2.7.6.tgz
tar zxvf Python-2.7.6.tgz
cd Python-2.7.6
./configure
make & make install

2、设置python2.7.6为默认版本,此处python2.6.6为系统内建版本,不知道当前版本的可以使用 python -V 命令查看

mv /usr/bin/python /usr/bin/python2.6.6
ln -s /usr/local/bin/python2.7 /usr/bin/python
修改完毕后可以 python -V 查看一下是否成功

3、由于yum依赖内建python,所以需要修改一下yum依赖

vi /usr/bin/yum
说明:按 i 进入编辑模式,将第一行#!/usr/bin/python 改为 #!/usr/bin/python2.6.6,后者为内建python版本,然后按esc退出编辑模式,按shift+: ,输入wq保存文件即可~

二、安装pip
1、安装setuptools(pip需要这个),依次执行

cd /root
wget http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg –no-check-certificate
sh setuptools-0.6c11-py2.7.egg

如果提示 zipimport.ZipImportError: can’t decompress data; zlib not available ,说明需要安装zlib库

cd /root/Python-2.7.6/Modules/zlib
./configure
make & make install

重新编译一下python

cd /root/Python-2.7.6
make & make install

安装setuptools

cd /root
sh setuptools-0.6c11-py2.7.egg

2、安装pip

cd /root
wget http://pypi.python.org/packages/source/p/pip/pip-1.5.4.tar.gz –no-check-certificate
tar zxvf pip-1.5.4.tar.gz
cd pip-1.5.4
python setup.py install

三、安装shadowsocks
由于安装了pip所以很简单了,一行命令的事

pip install shadowsocks

此时不推荐运行shadowsocks

四、安装M2Crypto
shadowsocks支持以下加密方式:

aes-128-cfb、aes-192-cfb、aes-256-cfb、bf-cfb、camellia-128-cfb、camellia-192-cfb、camellia-256-cfb、cast5-cfb、des-cfb、idea-cfb、rc2-cfb、rc4、seed-cfb、table

默认加密方法 table 速度很快,但很不安全,推荐使用 “aes-256-cfb” 或者 “bf-cfb”,使用加密必须安装M2Crypto。

1、安装swig
yum里swig版本太旧,如果使用yum安装基本上都是被坑的,如果系统集成大多也会有同样的问题
首先查看swig版本,如果是1.x版的先卸载掉

swig -version

执行以下命令

cd /root
wget http://jaist.dl.sourceforge.net/project/swig/swig/swig-3.0.0/swig-3.0.0.tar.gz
tar zxvf swig-3.0.0.tar.gz
cd swig-3.0.0
./configure
make & make install

安装完成后可以查看一下版本

swig -version

2、安装M2Crypto

cd /root
wget https://pypi.python.org/packages/source/M/M2Crypto/M2Crypto-0.22.3.tar.gz –no-check-certificate
tar zxvf M2Crypto-0.22.3.tar.gz
cd M2Crypto-0.22.3
python setup.py build
python setup.py install

五、安装Gevent
安装Gevent可以获得更好的性能,不管效果怎样,还是装个吧…
1、安装easy_install并安装greenlet

cd /root
wget -q http://peak.telecommunity.com/dist/ez_setup.py
python ez_setup.py
easy_install greenlet

2、安装Gevent(小内存VPS上可能无法通过)

cd /root
wget http://pypi.python.org/packages/source/g/gevent/gevent-0.13.8.tar.gz
tar zxvf gevent-0.13.8.tar.gz
cd gevent-0.13.8
python setup.py build
python setup.py install

六、运行shadowsocks
1、任意目录下建立一个名为“config.json”的文件,并编辑文本

touch config.json
vi config.json

2、设置shadowsocks服务端,按i进入编辑,将以下内容输入到文本中,编辑完成后按Esc退出编辑,然后Shift+:,输入wq保存

{
“server”:”my_server_ip”,
“server_port”:1024,
“local_port”:1989,
“password”:”lolicon”,
“timeout”:600,
“method”:”aes-256-cfb”
}

各字段的含义:

server 服务器 IP (IPv4/IPv6),注意这也将是服务端监听的 IP 地址
server_port 服务器端口
local_port 本地端端口
password 用来加密的密码
timeout 超时时间(秒)
method 加密方法,可选择 “bf-cfb”, “aes-256-cfb”, “des-cfb”, “rc4”, 等等。默认是一种不安全的加密,推荐用 “aes-256-cfb”

3、在config.json文件所在目录执行

ssserver (前台运行)
nohup ssserver > log & (后台一直运行)

4、如果成功运行,但是无法连接,可能是iptables设置问题,可以选择添加当前端口到白名单或关闭iptables解决

请将“1024”改为你所设置的服务器端口
iptables -I INPUT -p tcp -m tcp –dport 1024 -j ACCEPT
service iptables save (建议)
或者关闭iptables(不建议)
/etc/rc.d/init.d/iptables stop

5、客户端设置网上一搜一大把,就不赘述了…
Windows客户端:https://github.com/clowwindy/shadowsocks-csharp
Android客户端:https://play.google.com/store/apps/details?id=com.github.shadowsocks

 

—————————————————–

转载随意,修改随意,但请注明来源链接

引用:http://hazelzhu.com/archives/1568

还有谁能拯救我的Grive

CentOS 6.5 on Linode

# grive -a

grive: Symbol `json_tokener_errors' has different size in shared object, consider re-linking

-----------------------

Please go to this URL and get an authentication code:

https://accounts.google.com/o/oauth2/auth?*hidden*

-----------------------
Please input the authentication code here:
*hidden*
Reading local directories
Synchronizing folders
exception: /root/rpmbuild/BUILD/grive/libgrive/src/protocol/AuthAgent.cc(174): Throw in function long int gr::AuthAgent::CheckHttpResponse(long int, const std::string&, const gr::http::Header&)
Dynamic exception type: N5boost16exception_detail10clone_implIN2gr4http5ErrorEEEstd::exception::what: std::exception
[PN2gr4http15HttpResponseTagE] = 400
[PN2gr4http6UrlTagE] = https://docs.google.com/feeds/default/private/full/-/folder?max-results=50&showroot=true
[PN2gr4http9HeaderTagE] = Authorization: Bearer *hidden*
GData-Version: 3.0