root@Linuxserver ~ > ssh -t -l root 192.168.2.1 '. ~/.profile;/var/media/ftp/Intenso-RainbowLine-01/MyUtils/LanDeviceActive.pl HP-Laptop'
root@Linuxserver ~ > ssh -t -l root 192.168.2.1 echo $?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
package main; use strict; use warnings; use Net::SSH::Perl; #Test_FB_abfrage sub PersonPresent($) { my $host = "192.168.2.1"; my $user = "root"; my $landevice = $_[0]; my $ssh2fritzbox = Net::SSH::Perl->new($host, debug=>3, identity_files=>["/root/.ssh/id_rsa"]); $ssh2fritzbox->login($user); my($stdout, $stderr, $exit) = $ssh2fritzbox->cmd(". ~/.profile; /var/media/ftp/Intenso-RainbowLine-01/MyUtils/LanDeviceActive.pl $landevice"); Log 3, ">>> $landevice $exit"; return $exit; }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Linuxserver: Reading configuration data /root/.ssh/config
Linuxserver: Reading configuration data /etc/ssh_config
Linuxserver: Connecting to 192.168.2.1, port 22.
Linuxserver: Remote protocol version 2.0, remote software version dropbear_0.52
Linuxserver: Net::SSH::Perl Version 1.35, protocol version 2.0.
.inuxserver: No compat match: dropbear_0.52
Linuxserver: Connection established.
Linuxserver: Sent key-exchange init (KEXINIT), wait response.
Linuxserver: Algorithms, c->s: 3des-cbc hmac-sha1 none
Linuxserver: Algorithms, s->c: 3des-cbc hmac-sha1 none
Linuxserver: Entering Diffie-Hellman Group 1 key exchange.
Linuxserver: Sent DH public key, waiting for reply.
Linuxserver: Received host key, type 'ssh-dss'.
Linuxserver: Host '192.168.2.1' is known and matches the host key.
Linuxserver: Computing shared secret key.
Linuxserver: Verifying server signature.
Linuxserver: Waiting for NEWKEYS message.
Linuxserver: Send NEWKEYS.
Linuxserver: Enabling encryption/MAC/compression.
Linuxserver: Sending request for user-authentication service.
Linuxserver: Service accepted: ssh-userauth.
Linuxserver: Trying empty user-authentication request.
Linuxserver: Authentication methods that can continue: publickey,password.
Linuxserver: Next method to try is publickey.
Linuxserver: Trying pubkey authentication with key file '/root/.ssh/id_rsa'
Linuxserver: Will not query passphrase for '/root/.ssh/id_rsa' in batch mode.
Linuxserver: Loading private key failed.
Linuxserver: Next method to try is password.
Linuxserver: Trying password authentication.
Linuxserver: Will not query passphrase in batch mode.
Linuxserver: Authentication methods that can continue: publickey,password.
Linuxserver: Next method to try is publickey.
Linuxserver: Trying pubkey authentication with key file '/root/.ssh/id_rsa'
Linuxserver: Will not query passphrase for '/root/.ssh/id_rsa' in batch mode.
Linuxserver: Loading private key failed.
Linuxserver: Next method to try is password.
Linuxserver: Trying password authentication.
Linuxserver: Will not query passphrase in batch mode.
1
2
3
4
0 local:~ $ ssh hostname 'false' # $?=1
1 local:~ $ ssh hostname 'echo $?'
0
0 local:~ $
1
2
3
4
5
6
7
8
9
10
root@Linuxserver ~ > ssh 192.168.2.1
BusyBox v1.19.3 (2012-05-21 13:40:41 CEST) built-in shell (ash)
Enter 'help' for a list of built-in commands.
ermittle die aktuelle TTY
tty is "/dev/pts/0"
Console Ausgaben auf dieses Terminal umgelenkt
#
2013-01-21T11:05:23 GwenDragonZeile 12: login ohne Passwort?
Kann nicht sein! So schludrig ist kein Router mit einem SSH-Schlüssel abgesichert.
1
2
Linuxserver: Will not query passphrase for '/root/.ssh/id_rsa' in batch mode.
Linuxserver: Loading private key failed.
QuoteEs gibt da wohl (im Batch-Mode) ein Problem, den Key zu laden; damit kann die Anmeldung nicht mit diesem Key stattfinden!
1 2 3 4 5 6 7
my $host = "192.168.2.1"; my $user = "root"; my $pass = "meinpsswd"; my $landevice = $_[0]; my $ssh = Net::SSH::Perl->new($host, debug=>3); $ssh->login($user, $pass); my($stdout, $stderr, $exit) = $ssh->cmd(". ~/.profile; /var/media/ftp/Intenso-RainbowLine-01/MyUtils/LanDeviceActive.pl $landevice");
QuoteWenn ich es über die Konsole gemacht habe war ich Root
/root/.ssh/id_rsa
QuoteWenn du nicht root bist, kommst du doch gar nicht an das Verzeichnis /root/.ssh dran!
1
2
3
4
5
6
7
8
9
root@Linuxserver ~ > ssh 192.168.2.1
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for '/root/.ssh/id_rsa' are too open.
It is recommended that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: /root/.ssh/id_rsa
root@192.168.2.1's password: