服务器端创建新用户

为服务器安全起见,创建用户(用户名:yishi):

useradd yishi

设置密码:

passwd yishi

添加sudo权限:

usermod -aG wheel yishi

关闭Root的远程访问

修改/etc/ssh/sshd_config

PermitRootLogin no

然后:

service sshd restart

开启SSH的公钥访问

$ cat id_rsa.pub >> ~/.ssh/authorized_keys
$ chmod 700 ~/.ssh
$ chmod 600 ~/.ssh/id_rsa 
# Disable password authentication forcing use of keys
PasswordAuthentication no

https://wiki.centos.org/HowTo...

MongoDB

Create/etc/yum.repos.d/mongodb-org-3.2.repo,Content:

[mongodb-org-3.2]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.2/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.2.asc

Client only:

sudo yum install -y mongodb-org-shell

https://docs.mongodb.com/manu...

语言报错的处理

export LC_ALL=C
mongo

http://askubuntu.com/question...

NodeJS连接阿里云MongoDB数据库

dbURI = sprintf("mongodb://%s:%s@%s:%d,%s:%d/%s?replicaSet=%s", conf.username, conf.password, conf.host1, conf.port1, conf.host2, conf.port2, conf.dbname, conf.replSetName);

随机密码-MAC上

openssl rand -hex 16

e10101
352 声望10 粉丝

业余程序员