Connectrix MDS: So erstellen Sie kennwortlosen Zugriff vom SAN-Switch auf den UNIX-Server

Summary: Der kennwortlose Zugriff vom Switch auf den UNIX-Server kann durch Erzeugen eines öffentlichen/privaten Schlüsselpaars auf dem MDS-Switch und Hinzufügen des öffentlichen Schlüssels zu einem Nutzerkonto authorized_keys einer Datei auf dem SSH-Server abgerufen werden. ...

This article applies to This article does not apply to This article is not tied to any specific product. Not all product versions are identified in this article.

Instructions

Einrichten des Paars aus öffentlichem/privatem Schlüssel für das Nutzerkonto auf dem MDS

Schritt 1:
Erstellen Sie vom MDS 9000-Switch aus den Nutzernamen "test" mit einem Kennwort und der Rolle "network-admin". Erstellen Sie den Nutzer und den Nutzer mit der Rolle "network-admin", damit das Schlüsselpaar generiert werden kann.
 

sw1# conf t
Enter configuration commands, one per line. End with CNTL/Z.
sw1(config)# username test password <password> role network-admin
sw1(config)# cop run start
[########################################] 100%
sw1(config)#



Schritt 2: Stellen Sie eine SSH-Verbindung zum Switch vom Linux-Host mit dem im vorherigen Schritt erstellten Nutzernamen her:
 

sj-lnx[]:~$ ssh testuser@A.X.Y.Z
User Access Verification
Password:
Cisco Nexus Operating System (NX-OS) Software
TAC support: http://www.cisco.com/tac
Copyright (c) 2002-2010, Cisco Systems, Inc. All rights reserved.
The copyrights to certain works contained in this software are
owned by other third parties and used and distributed under
license. Certain components of this software are licensed under
the GNU General Public License (GPL) version 2.0 or the GNU
Lesser General Public License (LGPL) Version 2.1. A copy of each
such license is available at
http://www.opensource.org/licenses/gpl-2.0.php and
http://www.opensource.org/licenses/lgpl-2.1.php
sw1#



Schritt 3:Generieren Sie das Schlüsselpaar für den Nutzertest mit RSA mit einer Länge von 1024 Bit.
 

sw1# conf t
Enter configuration commands, one per line. End with CNTL/Z.
sw1(config)# username test keypair generate rsa 1024
generating rsa key(1024 bits)......
generated rsa key
sw1(config)# show username test keypair
**************************************

rsa Keys generated:<Date>
ssh-rsa AAAA...........................................................
...........<truncated>.........................................
bitcount:1024
fingerprint:
.<truncated>
**************************************
could not retrieve dsa key information
**************************************
sw1(config)# cop run start
[########################################] 100%
sw1(config)#



Schritt 4:Exportieren Sie das Schlüsselpaar in Bootflash: Geben Sie die Passphrase an (es kann alles sein, notieren Sie sie sich einfach irgendwo).
 

sw1(config)# username test keypair export bootflash:test_rsa rsa
Enter Passphrase:
sw1(config)# dir bootflash:
16384 Apr 15 15:21:31  lost+found/
18693120 Apr 15 15:22:55  m9100-s3ek9-kickstart-mz.5.0.1a.bin
73579433 Apr 15 15:23:53  m9100-s3ek9-mz.5.0.1a.bin
5778 Apr 15 15:24:48  mts.log
951 Apr 16 15:07:01  test_rsa
219 Apr 16 15:07:02  test_rsa.pub
Usage for bootflash://sup-local
143622144 bytes used
533487616 bytes free
677109760 bytes total
sw1(config)#


Einrichten des Paars aus öffentlichem/privatem Schlüssel für das Nutzerkonto auf dem Linux-Host

Schritt 1:Kopieren Sie den öffentlichen RSA-Schlüssel für den Nutzer "testuser" vom Switch auf den Linux-Host mit dem bereits vorhandenen Nutzernamen "test".

Hinweis: Sie müssen das Kennwort für den Nutzernamentest angeben, das mit dem zuvor auf dem Switch erstellten Kennwort identisch sein kann oder auch nicht.

In diesen Anweisungen wird ein Beispiel verwendet, bei dem der Pfad des Testkontos /users/test. Je nach Linux-Version kann dieser Pfad unterschiedlich sein.

 

sw1(config)# copy bootflash:testuser_rsa.pub scp://test@192.X.Y.Z/users/test/.ssh
The authenticity of host 'A.X.Y.Z (A.X.Y.Z)' can't be established.
RSA key fingerprint is .........<truncated>.................
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'A.X.Y.Z' (RSA) to the list of known hosts.


test@A.X.Y.Z's password:
testuser_rsa.pub 100% 219 0.2KB/s 00:00

sw1(config)# dir bootflash:
16384 Apr 15 15:21:31  lost+found/
18693120 Apr 15 15:22:55 m9100-s3ek9-kickstart-mz.5.0.1a.bin
73579433 Apr 15 15:23:53  m9100-s3ek9-mz.5.0.1a.bin
5778 Apr 15 15:24:48  mts.log
951 Apr 16 15:07:01 test_rsa
219 Apr 16 15:07:02  test_rsa.pub

Usage for bootflash://sup-local
143622144 bytes used
533487616 bytes free
677109760 bytes total

sw1(config)#



Schritt 2 :Auf dem Linux-Server müssen Sie den Inhalt der Datei test_rsa.pub zur authorized_keys-Datei (oder authorized_keys2-Datei, abhängig von Ihrer SSH-Version) hinzufügen:
 

sj-lnx[]:~/$ cd .ssh
sj-lnx[]:~/.ssh$ chmod 644 authorized_keys2
sj-lnx[]:~/.ssh$ ls -lrt

lrwxrwxrwx 1 test eng 16 Apr 7  authorized_keys -> authorized_keys2
-rw-r--r-- 1 test eng 1327 Apr 16 15:04 authorized_keys2
-rw-r--r-- 1 test eng 219 Apr 16 15:13 test_rsa.pub

sj-lnx[94]:~/.ssh$ cat test_rsa.pub

ssh-rsa
...................<truncated>................................

sj-lnx[]:~/.ssh$ cat test_ras.pub >> authorized_keys2
sj-lnx[]:~/.ssh$ cat authorized_keys2
ssh-rsa
.........................<truncated>...........................




Testen Sie SCP vom Switch zum Linux-Host.

Testen Sie SCP vom Switch auf den Linux-Server und überprüfen Sie die Kopie vom Switch auf den Server ohne Angabe des Kennworts. (Beachten Sie, dass "Kein Kennwort wird abgefragt für..." )
 

sw1(config)# dir bootflash:
16384 Apr 15 15:21:31  lost+found/
18693120 Apr 15 15:22:55  m9100-s3ek9-kickstart-mz.5.0.1a.bin
73579433 Apr 15 15:23:53  m9100-s3ek9-mz.5.0.1a.bin
5778 Apr 15 15:24:48  mts.log
951 Apr 16 15:07:01  test_rsa
219 Apr 16 15:07:02  test_rsa.pub

Usage for bootflash://sup-local
143622144 bytes used
533487616 bytes free
677109760 bytes total

sw1(config)# copy bootflash:mts.log scp://test@A.X.Y.Z/users/test


mts.log 100% 5778 5.6KB/s 00:00
sw1(config)#

Affected Products

Connectrix MDS-Series Hardware
Article Properties
Article Number: 000184888
Article Type: How To
Last Modified: 18 Jul 2025
Version:  2
Find answers to your questions from other Dell users
Support Services
Check if your device is covered by Support Services.