Red Hat, CentOS, Fedora 系统需要安装 pam-devel 包:
yum install git pam-devel make gcc-c++ wget -y
Ubuntu,Linux Mint,Debian 系统需要安装‘libpam0g-dev包:
apt-get install git libpam0g-dev make gcc-c++ wget -y
git clone https://github.com/google/google-authenticator.git
cd google-authenticator/libpam
./bootstrap.sh
make && make install
google-authenticator
Do you want authentication tokens to be time-based (y/n) y
二维码地址
https://www.google.com/chart?chs=200x200&chld=M|0&cht=qr&chl=otpauth://totp/root@localhost%3Fsecret%XXXXXXXXXXXXXX
Your new secret key is: XXXXXXXXXXXX
Your verification code is 000000
紧急码,只能使用一次
Your emergency scratch codes are:
80801116
43011118
34981118
88321117
93711113
Do you want me to update your "/root/.google_authenticator" file (y/n) y
Do you want to disallow multiple uses of the same authentication
token? This restricts you to one login about every 30s, but it increases
your chances to notice or even prevent man-in-the-middle attacks (y/n) y
#每30秒生成一个token
By default, tokens are good for 30 seconds and in order to compensate for
possible time-skew between the client and the server, we allow an extra
token before and after the current time. If you experience problems with poor
time synchronization, you can increase the window from its default
size of 1:30min to about 4min. Do you want to do so (y/n) y
If the computer that you are logging into isn't hardened against brute-force
login attempts, you can enable rate-limiting for the authentication module.
By default, this limits attackers to no more than 3 login attempts every 30s.
Do you want to enable rate-limiting (y/n) y
auth sufficient pam_google_authenticator.so
注释:
auth include password-auth
PubkeyAuthentication yes
ChallengeResponseAuthentication yes
AuthenticationMethods publickey,keyboard-interactive
PasswordAuthentication no
UsePAM yes
service sshd restart
Andorid版
https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2
iOS版
https://itunes.apple.com/cn/app/google-authenticator/id388497605
手机端打开google 身份验证器,扫二维码或者输入secret key
[root@localhost ~]# ssh 127.0.0.1
Authenticated with partial success.
Verification code: 6位动态码
Last login: Thu Aug 14 15:20:16 2015 from 127.0.0.1
[root@localhost ~]#
]]>psql -U user -d dbname
\c dbname
\l
\dt
\d tblname
\di
create database dbname;
create database dbname OWNER rolename;
drop database dbname;
alter table oldtablename rename to newtablename;
drop table tablename;
]]>yum install readline readline-devel make zlib zlib-devel
wget https://ftp.postgresql.org/pub/source/v9.3.2/postgresql-9.3.2.tar.gz
tar -zxf postgresql-9.3.2.tar.gz
cd postgresql-9.3.2
./configure --prefix=/usr/local/pgsql --with-openssl
gmake
gmake install
groupadd postgres
adduser -g postgres postgres
mkdir /usr/local/pgsql/data
chown postgres:postgres /usr/local/pgsql/data
su - postgres
/usr/local/pgsql/bin/psql -V
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data --locale=en_US.UTF8 -U postgres
cp contrib/start-scripts/linux /etc/init.d/postgresql
chmod a+x /etc/init.d/postgresql
/etc/init.d/postgresql start
/usr/local/pgsql/bin/createdb test
/usr/local/pgsql/bin/psql -U postgres test
在~./bash_profile添加如下内容:
PGHOME=/usr/local/pgsql
PGDATA=$PGHOME/data
PATH=$PATH:$HOME/bin:$PGHOME/bin
export PGHOME
export PGDATA
export PATH
----------------------------
LD_LIBRARY_PATH=/usr/local/pgsql/lib
export LD_LIBRARY_PATH
PATH=/usr/local/pgsql/bin:$PATH
export PATH
PostgreSQL9.3安装完成。
]]>
|
|
|
|
|
|
|
|