I made a client server program using Paramiko. I manage to get a connection, and send command. For example if I send a 'ifconfig' command, it indeed returns the desired output. Yet, when I try to send an 'ls' command, it returns nothing. I need the server to let me use more complicated commands, like opening files, editing wordpress and so on.
This sends the sshCommand:
def sshCommand(command, port=22):
sshClient = paramiko.SSHClient() # create SSHClient instance
sshClient.set_missing_host_key_policy(
paramiko.AutoAddPolicy()) # AutoAddPolicy automatically adding the hostname and new host key
sshClient.load_system_host_keys()
sshClient.connect(host, port, username, password)
stdin, stdout, stderr = sshClient.exec_command(command)
print(stdout.read())
When I send -
sshCommand('ifconfig')
Everything works. But, sending -
sshCommand('ls')
Could it be that for some reason I don't have permission to access the files? I also have the root password which is used to connect.
Any help would be appreciated.