[SSH] : commande à distance
Résolu
tlep
Messages postés
596
Date d'inscription
Statut
Membre
Dernière intervention
-
zipe31 Messages postés 36402 Date d'inscription Statut Contributeur Dernière intervention -
zipe31 Messages postés 36402 Date d'inscription Statut Contributeur Dernière intervention -
A voir également:
- Ssh commande à distance
- Invite de commande - Guide
- Allumer pc à distance - Guide
- Commande terminal mac - Guide
- Ssh download - Télécharger - Divers Web & Internet
- Commande dism - Guide
8 réponses
Si je fais:
ssh root@192.168.203.33 'bash -c "for i in `ls /home`;do ls $i;done"'
bash: -c: line 2: syntax error near unexpected token `billingbzh'
bash: -c: line 2: `billingbzh'
Si je fais :
ssh root@192.168.203.33 "bash -c 'for i in `ls /home`;do ls $i;done'"
bash: -c: line 2: syntax error near unexpected token `conf'
bash: -c: line 2: `conf'
LOL :-))
ssh root@192.168.203.33 'bash -c "for i in `ls /home`;do ls $i;done"'
bash: -c: line 2: syntax error near unexpected token `billingbzh'
bash: -c: line 2: `billingbzh'
Si je fais :
ssh root@192.168.203.33 "bash -c 'for i in `ls /home`;do ls $i;done'"
bash: -c: line 2: syntax error near unexpected token `conf'
bash: -c: line 2: `conf'
LOL :-))
C'est juste un problème de ls :
ls $i ne fonctionne pas car tu ne te trouves pas dans le bon répertoire.
Il faut exécuter ls /home/$i !
Donc : ssh root@192.168.xxx.xx 'bash -c "for i in `ls /home`;do ls /home/$i;done"'
ls $i ne fonctionne pas car tu ne te trouves pas dans le bon répertoire.
Il faut exécuter ls /home/$i !
Donc : ssh root@192.168.xxx.xx 'bash -c "for i in `ls /home`;do ls /home/$i;done"'
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
Y'a du mieux il plante plus sur "conf" :
ssh root@192.168.xxx.xx bash -c "for i in `ls /home`;do ls $i;done"
ca me donne :
i: -c: line 1: syntax error near unexpected token `newline'
i: -c: line 1: `for'
bash: line 2: conf: command not found
bash: line 3: crm: command not found
bash: line 4: custuser: command not found
bash: line 5: log: command not found
bash: line 6: lost+found: command not found
bash: line 7: nttuser: command not found
bash: line 8: nusoap: command not found
bash: line 9: website: command not found
bash: -c: line 10: syntax error near unexpected token `do'
bash: -c: line 10: `ws;do ls ;done'
ssh root@192.168.xxx.xx bash -c "for i in `ls /home`;do ls $i;done"
ca me donne :
i: -c: line 1: syntax error near unexpected token `newline'
i: -c: line 1: `for'
bash: line 2: conf: command not found
bash: line 3: crm: command not found
bash: line 4: custuser: command not found
bash: line 5: log: command not found
bash: line 6: lost+found: command not found
bash: line 7: nttuser: command not found
bash: line 8: nusoap: command not found
bash: line 9: website: command not found
bash: -c: line 10: syntax error near unexpected token `do'
bash: -c: line 10: `ws;do ls ;done'
ssh root@192.168.xxx.xx 'bash -c "for i in `ls /home`;do ls $i;done"'
peut-être ?
(sinon il va probablement prendre -c et ce qui suit comme une option de ssh.
peut-être ?
(sinon il va probablement prendre -c et ce qui suit comme une option de ssh.
Salut,
merci çà marche !
Tu peux expliquer le mystère ?
-Est-ce que je peux exécuter un shell créé en local via ssh ?
Par exemple créer un script sur la machine A puis l'exécuter via ssh :
ssh root@B 'bash -c 'mon_script.sh' ?
Apparemment non puisque mon_script.sh se trouve sur A et va essayer de l'exécuter sur B ?
merci çà marche !
Tu peux expliquer le mystère ?
-Est-ce que je peux exécuter un shell créé en local via ssh ?
Par exemple créer un script sur la machine A puis l'exécuter via ssh :
ssh root@B 'bash -c 'mon_script.sh' ?
Apparemment non puisque mon_script.sh se trouve sur A et va essayer de l'exécuter sur B ?