Monthly Archives: March 2016

cloudlinux add node.js

curl --silent --location | bash -
yum -y install nodejs
npm install -g grunt grunt-cli gulp bower

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

paths=/usr/bin/node, /usr/bin/npm, /usr/lib/node_modules

touch /etc/cagefs/conf.d/grunt.cfg
comment=Grunt tools

touch /etc/cagefs/conf.d/gulp.cfg
comment=Gulp tools

touch /etc/cagefs/conf.d/bower.cfg
comment=Bower web tools

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
openssl req -new -x509 -days 3650 -key -out server.crt
chmod 600 server.*

vi /etc/mail/
O CACertPath=/etc/mail/cert
O CACertFile=/etc/mail/cert/server.crt
O ServerCertFile=/etc/mail/cert/server.crt
O ServerKeyFile=/etc/mail/cert/
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/

ls -la ~/.ssh/cm_socket/ | grep

rm -rf ~/.ssh/cm_socket/root@

Another way: ssh -O stop

ansible change root password

ansible change root password command line

pwgen -n 15 -c 1

using new python3:
python3 -c "import crypt; print(crypt.crypt('soo2Echu7SooLao', '\$6\$eyoo3seivengu3cei'))"

using old python2:
python -c 'import crypt; print crypt.crypt("soo2Echu7SooLao", "$6$saltsalt$")'

If you are getting error File "", line 1
import crypt; print crypt.crypt
SyntaxError: invalid syntax
use python3

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

ansible -i inv xx.xx.xx.xx -m user -a ' name=root password=$6$eyoo3seivengu3ce$U30IkaHvd9Zmf4PPl1ZVR0G4coP6JZFwW/uxMkiVZV8vL2WjZaYrmsalfJ9snLjGR8rGKhCEyZpX5cRhAIf.R0' -k

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