본문 바로가기
취미/linux 기초

Tina Linux SSH server 설정 (1)

by 심심해43 2022. 11. 11.
반응형

Tina Linux  SDK를 이용하는  테스트 보드를 시작하며 ssh 연결이 안 되어있어 매우 불편했습니다.

 

MobaXterm 등을 이용할수도 없어서 연결을 시도해보고 기록해 봅니다. 

 

 

 

처음 ssh 관련 패키지가 설치되어있지 않기 때문에 설치를 시작합니다. 

 

1. tina package 를 추가하기 위해 menuconfig를 실행해 추가합니다. 

$ make menuconfig 

메뉴에서 아래 ssh 항목을 ON 합니다. 

> Network > SSH ───
< > openssh-client............................................ OpenSSH client  │ │  
< > openssh-client-utils............................ OpenSSH client utilities  │ │  
-*- openssh-keygen............................................ OpenSSH keygen  │ │  
< > openssh-moduli....................................... OpenSSH moduli file  │ │  
<*> openssh-server............................................ OpenSSH server  │ │  
< > openssh-server-pam..................... OpenSSH server (with PAM support)  │ │  
< > openssh-sftp-client.................................. OpenSSH SFTP client  │ │  
< > openssh-sftp-server.................................. OpenSSH SFTP server 

추가로 다음 항목도 설치 합니다. (꼭 필요한지는 확인이 필요합니다. 일단 추가.) 

 > Network > IP Addresses and Names ─
        -*- mdns-utils......................................... mDNS client utilities  │ │  
        -*- mdnsd................................................. mDNS server daemon  │ │  
        <*> mdnsresponder.......................................... mDNS suite (meta) 
        ~~~~
      <*> mdns........................................ OpenWrt Multicast DNS Daemon     
     
     > Base system ──
     <*> dropbear........................................ Small SSH2 client/server

 

2. 이후 SDK 전체 패키지 빌드를 실행합니다. 

$ make 

3. 문제없이 빌드가 되고, 이미지를 보드에 구운 후  /etc/ssh 폴더가 생기고, 여러 위치에 해당 파일이 설정되었습니다.

  먼저 /etc/ssh/sshd_config  파일을 수정해 동작 설정을 해줍니다. 

$ vi /etc/ssh/sshd_config

sshd_config 파일이 초기에는 모두 # 로 주석처리되어있는데, 주석을 해제 또는 변경해줍니다. 

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options override the
# default value.

Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key

# Ciphers and keying
#RekeyLimit default none

# Logging
SyslogFacility AUTH
LogLevel INFO

# Authentication:

LoginGraceTime 2m
#PermitRootLogin prohibit-password
PermitRootLogin yes
StrictModes yes
MaxAuthTries 6
MaxSessions 10

#PubkeyAuthentication yes

# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile      .ssh/authorized_keys

#AuthorizedPrincipalsFile none

#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no

# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
#UsePAM no

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
#PrintMotd yes
#PrintLastLog yes
TCPKeepAlive yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#PidFile /var/run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none

# no default banner path
#Banner none

# override default of no subsystems
Subsystem       sftp    /usr/lib/sftp-server

# Example of overriding settings on a per-user basis
#Match User anoncvs
#       X11Forwarding no
#       AllowTcpForwarding no
#       PermitTTY no
#       ForceCommand cvs server

 

 

4. 실행을 해봅니다.  저의 경우엔 에러가 발생합니다. 

$ etc/init.d/sshd start

sshd 에러발생 1

 

 

 

5. 일단 실행해볼 수 있도록 에러를 처리해봅니다. 

 

1) /etc/init.d/sshd 파일을 수정해  procd_add_mdns 라인을 주석처리

 정확히 어떤 기능을 하는 함수인지는 모르겠지만 일단 주석처리합니다. 

/etc/init.d/sshd 주석처리

 

 

 

 

2)   Privilege separation user sshd does not exist  는 계정을 설정해야 하는 듯한데 

 검색을 해보니 설명이 있었습니다. 

sshd 에러 2

-   /etc/group  파일에 아래 내용을 추가/수정합니다. (저는 번호가 다르게 설정되어있어 일단 수정했습니다. )
    sshd:x:74:

-  /etc/passwd   파일에 아래쪽에 아래 문구를 추가합니다.  (저는 없어서 추가했습니다.) 
    sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin

 

 

 

6. 실행해봅니다.  

$ /etc/init.d/sshd start 

실행 후 ps로 확인해보니  아래처럼 실행되고 있습니다. 

  974 root      2888 S    /usr/sbin/sshd -D

 

 

 

7. MobaxTerm에서 연결해봅니다. 

  초기 연결 시  ID: root  , passwd : tina 인 것 같습니다.  

  연결 시 설정한 적도 없는 passwd를 입력하라고 해서 이것저것 넣어보다 운 좋게 되었네요.. 

 

아래와 같이 열결 되었습니다. 

MobaXterm 연결

한 가지 문제점은  주요 기능인 파일 전송이 안됩니다.   아직 뭔가 설정을 더 해줘야 하는 듯합니다. 

 

산 넘어 산이네요....  고수님들은 정말 대단하네요.. 

 

설정 잘 아시는분은 좀 알려주세요. ^^;;

'취미 > linux 기초' 카테고리의 다른 글

YU12, NV12 format 구조(YUV420)  (0) 2022.11.18
Tina Linux SSH server 설정 (2)  (0) 2022.11.15
MobaXterm 터미널 log 저장 하기  (0) 2022.11.04
linux .so .a 함수 들여다보기  (0) 2022.11.01
linux grep 문자열 검색  (0) 2022.11.01

댓글