Monthly Archives: March 2016

cloudlinux add node.js

curl --silent --location https://rpm.nodesource.com/setup_4.x | bash -
yum -y install nodejs
npm install -g grunt grunt-cli gulp bower

touch /etc/cagefs/conf.d/nodejs.cfg

[nodejs]
comment=Nodejs
paths=/usr/bin/node, /usr/bin/npm, /usr/lib/node_modules

touch /etc/cagefs/conf.d/grunt.cfg
[grunt]
comment=Grunt tools
paths=/usr/bin/grunt

touch /etc/cagefs/conf.d/gulp.cfg
[gulp]
comment=Gulp tools
paths=/usr/bin/gulp

touch /etc/cagefs/conf.d/bower.cfg
[bower]
comment=Bower web tools
paths=/usr/bin/bower

cagefsctl --force-update

sendmail enable tls

mkdir /etc/mail/cert
cd /etc/mail/cert

openssl genrsa -des3 -out server.key 1024
openssl rsa -in server.key -out server.key.open
openssl req -new -x509 -days 3650 -key server.key.open -out server.crt
chmod 600 server.*

vi /etc/mail/sendmail.cf
O CACertPath=/etc/mail/cert
O CACertFile=/etc/mail/cert/server.crt
O ServerCertFile=/etc/mail/cert/server.crt
O ServerKeyFile=/etc/mail/cert/server.key.open
O ClientKeyFile=/etc/mail/cert/server.crt

/etc/init.d/sendmail restart

ssh remove cm_socket session

If you still can get access to server without password after logout it means you have SSH ControlMaster session on your ~/.ssh/cm_socket/

So:
ls -la ~/.ssh/cm_socket/ | grep 132.168.2.100
root@132.168.2.100:22

rm -rf ~/.ssh/cm_socket/root@132.168.2.100:22

Another way: ssh -O stop 132.168.2.100

ansible change root password

pwgen -n 15 -c 1
soo2Echu7SooLao

python -c 'import crypt; print crypt.crypt("soo2Echu7SooLao", "$6$saltsalt$")'
$6$saltsalt$vot6A2I.VYFjfBPrgM0eTnqZqI4fzCz65Uc8Ez3mYJNokpOe72nFnQLlDQ..GnHGvj1HYTTwUU7YJmLyaAPM.1

Or using PERL perl -e 'print crypt("soo2Echu7SooLao","\$6\$saltsalt\$") . "\n"'

ansible -i inv vit -m user -a ' name=root password=$6$saltsalt$vot6A2I.VYFjfBPrgM0eTnqZqI4fzCz65Uc8Ez3mYJNokpOe72nFnQLlDQ..GnHGvj1HYTTwUU7YJmLyaAPM.1 ' -k

SSH password:
XX.XX.XX.XX | success >> {
"append": false,
"changed": true,
"comment": "root",
"group": 0,
"home": "/root",
"move_home": false,
"name": "root",
"password": "NOT_LOGGING_PASSWORD",
"shell": "/bin/bash",
"state": "present",
"uid": 0
}