- Блог пользователя administrator
- Комментировать
- 154248 reads
Метки: Asterisk, shell script, ssh
1. user is non root, need to login using it.
[root@as02 log]# su asterisk
This account is currently not available.
fixing this:
[root@as02 log]# chsh -s /bin/sh asterisk
to revert:
[root@as02 log]# chsh -s /sbin/nologin asterisk
2. ssh-keygen with default values and empty password.
3. it copies 2 files in home dir currently /var/lib/asterisk/.ssh
4. use public file in destionation server.
Generate public/private keys. For detailed instructions, see the OpenBSD Reference Manual from OpenBSD.
Notes
These instructions generate two files in ~/.ssh: id_rsa and id_rsa.pub.
In ESXi 5.x, the ssh-keygen command is located at /usr/lib/vmware/openssh/bin.
The preceding link was valid as of November 26, 2013. If you find the link to be broken, provide feedback on the article and a VMware employee will update the article as necessary.
On the remote host, store the public key content, id_rsa.pub in ~/.ssh/authorized_keys.
Notes
For ESXi 5.0, the location of authorized_keys is: /etc/ssh/keys-<username>/authorized_keys
More than one key can be stored in this file.
To allow root access, changePermitRootLogin no to PermitRootLogin yes in the /etc/ssh/sshd_config file.
To disable password login, ensure thatChallengeResponseAuthentication and PasswordAuthentication are set to no.
Reload the service:
For ESXi, run the command:
/etc/init.d/SSH restart
For ESX, run the command:
service sshd reload
5. chmod /priv file 600 and private file dir as 700
6. connect to server ssh root@name-or-ip "command".
7. it warning you about trust, say yes and it creates trust file in /homedir/.ssh so you will can connect without being prompted.
8. run scpirts using phone calls!
like this:
exten => 111,4,Authenticate(555)
exten => 111,5,System(/bin/server-halt.sh ${CALLERID(num)})
exten => 111,6,Playback(activated)
exten => 111,7,Playback(goodbye)
exten => 111,8,Hangup()
gl!