Linux 板


LINE

有一陣子沒有登入實驗室主機(Ubuntu), 今天使用terminal登入時, 發現無法登入. 嘗試登入太多次後, 有時會出現 ssh: connect to host XX port 22: Connection timed out 有時會出現 ERROR: ssh: connect to host XX port 22: Connection refused 有時會出現 Permission denied (publickey,password). 我知道登入太多次會直接被ban, 然後Connection refused, 要隔一段時間才能嘗試登入. 查過(publickey,password)的問題, 有可能沒有驗證成功, 所以也試了ssh-copy-id. 發現應該是被網管(學弟)改了帳號權限. 問了學弟, 他說他不懂Ubuntu, 只是被叫來做網管, 如果有被他改到什麼地方, 他不知道也不清楚. 他說也沒有root密碼, su -他沒用過, 他只會用sudo xxx這樣. 我試著用scp, 結果可以登入, 改用winscp, 也可以登入, 但是就是不能使用terminal模式登入. 請問Ubuntu突然變成scp可以登入但ssh不能登入, 是甚麼地方被改到了? --



※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 223.137.160.192 (臺灣)
※ 文章網址: https://webptt.com/m.aspx?n=bbs/Linux/M.1614588577.A.A37.html ※ 編輯: ruthertw (223.137.160.192 臺灣), 03/01/2021 16:54:24
1F:→ holishing: 你學弟知道怎麼查 log 嗎? 知道怎麼從 03/01 17:01
2F:→ holishing: /etc/ssh/sshd_config 檢查修改設定嗎? 03/01 17:01
剛剛我拉出sshd_config # $OpenBSD: sshd_config,v 1.101 2017/03/14 07:19:07 djm Exp $ # 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 #StrictModes yes #MaxAuthTries 6 #MaxSessions 10 #PubkeyAuthentication yes # Expect .ssh/authorized_keys2 to be disregarded by default in future. #AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2 #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 yes to enable challenge-response passwords (beware issues with # some PAM modules and threads) ChallengeResponseAuthentication no # Kerberos options #KerberosAuthentication no #KerberosOrLocalPasswd yes #KerberosTicketCleanup yes #KerberosGetAFSToken no # GSSAPI options #GSSAPIAuthentication no #GSSAPICleanupCredentials yes #GSSAPIStrictAcceptorCheck yes #GSSAPIKeyExchange no # 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 yes #AllowAgentForwarding yes #AllowTcpForwarding yes #GatewayPorts no X11Forwarding yes #X11DisplayOffset 10 #X11UseLocalhost yes #PermitTTY yes PrintMotd no #PrintLastLog yes #TCPKeepAlive yes #UseLogin no #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 # Allow client to pass locale environment variables AcceptEnv LANG LC_* # override default of no subsystems Subsystem sftp /usr/lib/openssh/sftp-server # Example of overriding settings on a per-user basis #Match User anoncvs # X11Forwarding no # AllowTcpForwarding no # PermitTTY no # ForceCommand cvs server 看起來被有心人士加了很多# 學弟說他可以用terminal連接主機. 但是他好像也不能使用sudo xxx了 ※ 編輯: ruthertw (223.137.160.192 臺灣), 03/01/2021 17:10:49
3F:→ holishing: 那個一堆 # 通常是系統內建給你參考的 template..... 03/01 17:12
4F:→ holishing: sudo -i 進不去 root shell? 03/01 17:13
5F:→ MOONY135: https://reurl.cc/4yjVp3 感覺是這篇的反過來 03/01 17:41
6F:→ MOONY135: ssh -vvv username@host 可以看log 03/01 17:43
7F:→ CMJ0121: 該不會 login shell 被拔了吧? 03/01 20:08
8F:推 tomsawyer: # 是系統內建給你的設定檔 預設關閉的那種 03/01 20:40
9F:→ tomsawyer: 有可能是login shell 至於sudo是sudo group被拔吧 03/01 20:40
10F:推 Hurricaneger: 把那個帳號的硬碟空間砍掉一些垃圾就可以了! 03/01 22:50
11F:推 ucrxzero: 把PermitRootLogin 開起來重新service ssh restart看看 03/04 20:01







like.gif 您可能會有興趣的文章
icon.png[問題/行為] 貓晚上進房間會不會有憋尿問題
icon.pngRe: [閒聊] 選了錯誤的女孩成為魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一張
icon.png[心得] EMS高領長版毛衣.墨小樓MC1002
icon.png[分享] 丹龍隔熱紙GE55+33+22
icon.png[問題] 清洗洗衣機
icon.png[尋物] 窗台下的空間
icon.png[閒聊] 双極の女神1 木魔爵
icon.png[售車] 新竹 1997 march 1297cc 白色 四門
icon.png[討論] 能從照片感受到攝影者心情嗎
icon.png[狂賀] 賀賀賀賀 賀!島村卯月!總選舉NO.1
icon.png[難過] 羨慕白皮膚的女生
icon.png閱讀文章
icon.png[黑特]
icon.png[問題] SBK S1安裝於安全帽位置
icon.png[分享] 舊woo100絕版開箱!!
icon.pngRe: [無言] 關於小包衛生紙
icon.png[開箱] E5-2683V3 RX480Strix 快睿C1 簡單測試
icon.png[心得] 蒼の海賊龍 地獄 執行者16PT
icon.png[售車] 1999年Virage iO 1.8EXi
icon.png[心得] 挑戰33 LV10 獅子座pt solo
icon.png[閒聊] 手把手教你不被桶之新手主購教學
icon.png[分享] Civic Type R 量產版官方照無預警流出
icon.png[售車] Golf 4 2.0 銀色 自排
icon.png[出售] Graco提籃汽座(有底座)2000元誠可議
icon.png[問題] 請問補牙材質掉了還能再補嗎?(台中半年內
icon.png[問題] 44th 單曲 生寫竟然都給重複的啊啊!
icon.png[心得] 華南紅卡/icash 核卡
icon.png[問題] 拔牙矯正這樣正常嗎
icon.png[贈送] 老莫高業 初業 102年版
icon.png[情報] 三大行動支付 本季掀戰火
icon.png[寶寶] 博客來Amos水蠟筆5/1特價五折
icon.pngRe: [心得] 新鮮人一些面試分享
icon.png[心得] 蒼の海賊龍 地獄 麒麟25PT
icon.pngRe: [閒聊] (君の名は。雷慎入) 君名二創漫畫翻譯
icon.pngRe: [閒聊] OGN中場影片:失蹤人口局 (英文字幕)
icon.png[問題] 台灣大哥大4G訊號差
icon.png[出售] [全國]全新千尋侘草LED燈, 水草

請輸入看板名稱,例如:e-shopping站內搜尋

TOP