Показаны сообщения с ярлыком SSH. Показать все сообщения
Показаны сообщения с ярлыком SSH. Показать все сообщения

среда, 19 октября 2016 г.

Быстрый доступ для root'а по SSH в Solaris

Для доступа, например, в Live окружение, когда доступ есть только на консоли без возможности использовать буфер обмена и подобные интерактивные фичи, можно открыть SSH доступ, но по умолчанию роли root'а не разрешен доступ. Поэтому настраиваем:
1. vi /etc/ssh/sshd_config
    PermitRootLogin yes - поменять с no
2. vi /etc/default/login
    #CONSOLE=/dev/console - закомментировать
3. rolemod -K type=normal root
4. svcadm restart ssh - рестарт сервиса
теперь под "пользователем" root можно залогиниться (также можно пароль поменять passwd root).

вторник, 16 декабря 2014 г.

Копирование файлов (прошивки/конфиги) на и с Cisco ISR (SSH / SCP)

Взято отсюда: http://blog.prorouting.com/2013/12/easy-transfer-of-files-tofrom-cisco.html

Easy transfer of files to/from Cisco Router

As a consultant, I'm constantly working remotely with people but still need an easy way of transferring files with a router (captures, OS files, etc).  This tip is 101 stuff but since I needed to help someone today with this I thought I would pass it along.

My little scenario here is an example using IOS routers but I've also tested it on XE.

When I need to upload or download files to/from a router, I like to use SCP to transfer the files.  I like this better then trying to stand up an FTP or TFTP server.  This is especially handy when working with devices outside the firewall.  SCP uses Secure Shell (SSH) to securely copy files.  With SCP you connect directly to the device and transfer files back and forth.  This is useful for transferring captures or OS files.

On the router, you'll need to enable SSH, AAA, and SCP.

ip domain-name company.com

hostname routername

crypto key generate rsa general-keys modulus 2048

ip ssh version 2

username someuser privilege 15 secret somepassword

aaa new-model

aaa authentication login default local

aaa authorization exec default local

Enable SCP on the router.

ip scp server enable

Starting in 6.0(2)N1(1), NX-OS also supports SCP.
Enable with:

feature scp-server

On Mac or Linux, to push or pull the files, you can use the built in command line.

You don't have to but I suggest going to the directory on your computer where the file you want to upload is or where you want to download the file to.  Open terminal on your Mac or Linux to run the commands below.

Download file:
In this example I'm downloading the file callfail to the current local directory.  In case you don't catch it, the dot at the end means the current local directory.
scp username@5.5.5.5:flash:callfail .

In this example I'm downloading the file callfail to my Documents folder.
scp username@5.5.5.5:flash:callfail Documents/


Upload file:
In this example I'm uploading the IOS from the local directory to the router.
scp c2900-universalk9-mz.SPA.151-4.M7.bin username@5.5.5.5:flash:c2900-universalk9-mz.SPA.151-4.M7.bin

If you happen to be on Windows, WinSCP and PSCP (from the makers of putty) are pretty popular.  WinSCP is a GUI based option, PSCP is CLI like above.

Cisco Reference Doc:
http://www.cisco.com/en/US/docs/ios/sec_user_services/configuration/guide/sec_secure_copy_ps6922_TSD_Products_Configuration_Guide_Chapter.html

I recommend disabling the SCP server when not needed.

В качестве scp клиента можно пользоваться тем, что включен в пакет Putty.
 

вторник, 4 сентября 2012 г.

Проброс портов через SSH Линукс клиентом и Putty

В мемориз.
В "родном" Linux ssh client делается так:
ssh -L 44433:192.168.75.2:443 -L 54433:192.168.75.200:443 -L 43389:192.168.75.4:3389 username@ssh_gateway -N
в данном случае это не только port-forward, но еще и port-trigger (позднее мы будем коннектиться на localhost по портам, первым в записях -L).
В Putty похожее также реализовано (например, здесь: http://www.virtuallifestyle.nl/2010/03/tunneling-a-vsphere-client-connection-over-ssh/ отличное описание проброса нужных портов для VMWare Client'а с учетом того, что конкретно VMWare клиенту не следует устанавливать переключение портов - port-trigger, так как ему нужны свои родные порты 443,902 и 903). В целом, для Putty действия такие:
- новая ssh сессия (Session) - указываем ssh хост (будет ssh gateway),
- в разделе Connection / SSH / Tunnels / Add new forwarded port: указываем Source Port как Local (можно также указать, что он IPv4 или оставить Auto), в Destination Указываем адрес и порт на которые нужно будет пробросить коннекшен вида ip_server:port,
- добавляем Add это в таблицу Forwarded Ports,
- можно вернувшись в раздел Session сохранить (поименовав) ее.