주 메뉴 열기

wwiki β

바뀜

SSH

2,474 바이트 추가됨, 2024년 2월 28일 (수)
ssh config
== OpenSSH ==
https://www.openssh.com/
=== 설치 === ==== 리눅스 ====
데비안 계열에서 클라이언트 설치
ssh-keygen명령을 포함한다.<syntaxhighlight lang="bash">
$ apt update
$ apt install openssh-client
</syntaxhighlight>
==== 윈도우 ====MS문서: [https://docs.microsoft.com/ko-kr/windows-server/administration/openssh/openssh_install_firstuse OpenSSH 설치] <code>C:\WINDOWS\System32\OpenSSH\ssh.exe</code>에 설치된다.(8.6.0.1) 참고로 gitbash에서는(git version 2.44.0.windows.1) <code>C:\Program Files\Git\usr\bin</code>에 설치되며 ssh config파일의 위치도 다른 것으로 보인다.
위의 링크에 있지만, [[PowerShell|파워셀]]을 관리자 권한으로 실행해서 실행해야 서비스를 제어할 수 있다.<syntaxhighlight lang="powershell">
# Start the sshd service
Start-Service sshd
</syntaxhighlight>서비스 관리자에서 자동실행을 설정할 수 있다. (서비스명: OpenSSH SSH Server)
[https://docs.microsoft.com/ko-kr/windows-server/administration/openssh/openssh_server_configuration OpenSSH 서버 구성]
</syntaxhighlight>
==자동로그인=SYNOPSIS ===usage: ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-B bind_interface] [-b bind_address] [-c cipher_spec] [-D [bind_address:]port] [-E log_file] [-e escape_char] [-F configfile] [-I pkcs11] [-i identity_file] [-J [user@]host[:port]] [-L address] [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port] [-Q query_option] [-R address] [-S ctl_path] [-W host:port] [-w local_tun[:remote_tun]] destination [command] $ ssh -i .ssh/aws_arm64.pem admin@아이피 ==ssh-keygen==authentication key generation, management and conversion ssh-keygen [-q] [-b bits] [-t dsa | ecdsa | ed25519 | rsa] [-N new_passphrase] [-C comment] [-f output_keyfile]
===키 생성===
 
====리눅스====
$ ssh-keygen -t rsa
PS > ssh-keygen -t rsa
나머지는 엔터치면 기본값으로 .ssh 폴더에 생성된다.
====윈도우====파워쉘에서 생성할 수 있다.입력없이 생성하려면 PS > $ ssh-keygen -q -t rsa-N "" -f /[사용자홈]/.ssh/id_rsa
=====puttygen=====
The Secure Shell (SSH) Public Key File Format: https://datatracker.ietf.org/doc/html/rfc4716
=설정파일== 키 관리 ===-e This option will read a private or public OpenSSH key file and print to stdout the key in one of the formats specified by the -m option. The default export format is “RFC4716”. This option allows ex‐ porting OpenSSH keys for use by other programs, including several commercial SSH implementations. $ ssh-keygen -e [-m key_format] [-f input_keyfile] ==ssh config==ssh는 다음 순서로 설정 정보를 얻는다. # command-line options# user's configuration file (~/.ssh/config)# system-wide configuration file (/etc/ssh/ssh_config, 윈도우 OpenSSH_for_Windows_8.6p1, LibreSSL 3.4.3 경우에 C:/ProgramData/ssh/ssh_config)<syntaxhighlight lang="text">Host github.com PreferredAuthentications publickey IdentityFile ~/.ssh/id_rsa UserKnownHostsFile ~/.ssh/known_hosts Port 60</syntaxhighlight> === PreferredAuthentications ===선호하는 인증방법을 지정한다.  gssapi-with-mic,hostbased,publickey,keyboard-interactive,password === IdentityFile ===기본값은 ''~/.ssh/id_rsa'', ''~/.ssh/id_ecdsa'', ''~/.ssh/id_ecdsa_sk'', ''~/.ssh/id_ed25519'', ''~/.ssh/id_ed25519_sk'' and ''~/.ssh/id_dsa''. 이다. 윈도우에서는 버전에 따라서 전체경로를 <code>c:/User/[user name]/.ssh/id_rsa</code> 등으로 지정해야 하는 경우가 있다. === Port ===기본포트를 변경한 경우에 다음 명령으로 접속할 수 있다. $ ssh -v 사용자명@서버주소 == sshd config ==OpenSSH daemon configuration file ''/etc/ssh/sshd_config''<syntaxhighlight lang="apacheconf">
# 패스워드 인증허용여부
PasswordAuthentication no
편집
2,431