Issue
how do we create a tmux session using python based ssh client programs?
from pssh.clients import ParallelSSHClient
def Estabish_Connection(host,username,passkey):
client = ParallelSSHClient([str(host)],user=str(username), password=str(passkey))
return client
client2 = Estabish_Connection('host','root','password')
cmd_out = client2.run_command('tmux new -s myname')
for host,out in cmd_out.items():
for line in out.stdout:
print(line)
It doesn't create a tmux window on checking manually from a terminal.
> tmux ls
no server running on /tmp/tmux-0/default
Solution
open terminal failed: not a terminal
Okay well post the tmux bits of the script, by default it will try to attach to the current tty (which doesn't exist hence the error) if you have a new session in there for example you'll need to add a -d param to prevent this
tmux new-session -s username -d
Answered By - Arbazz Hussain