最新記事

SSH構成の変数ユーザー名
ssh
variable

SSH構成の変数ユーザー名

私は変数をSSH設定ファイルに解析する方法を探しています。現在、展開前に値を変更するスクリプトがあります。むしろこの段階を取り除きたいです。私は成功せずにマニュアルとリリースノートを何度も読んでいましたが、これが可能かどうかはまだわかりません。 私は次のようにすることが望ましいです: variable_user = boxuser Host thisbox Hostname thisbox User $variable_user 理想的には、他のすべてが標準化されたままになるように、ユーザー変数に設定を含めたいと思います。 私はあまりにも多くを要求しているのだろうか? 編集する: 構成は$ USER転送を解釈しません。 Host thisbox Hostname thisbox User $USER 結果: $ ssh thisbox $USER@thisbox's password: %uも同様です。

Admin

サーバー上のユーザーの
ssh

サーバー上のユーザーの "authorized_keys"ファイルで複数のSSHキーをどのように使用しますか?

私のサーバーで作業している3人のユーザーに対応する3つの公開SSHキーがあります。私のサーバーのユーザーがgitサーバーのgitリポジトリにアクセスできるようにするには、この3つの公開鍵が必要です。 gitSSHを介してユーザーがアクセスできるように、次のコマンドを実行しました。 cat /home/user_one/.ssh/authorized_keys >> /var/git/.ssh/authorized_keys cat /home/user_two/.ssh/authorized_keys >> /var/git/.ssh/authorized_keys cat /home/user_three/.ssh/authorized_keys >> /var/git/.ssh/authorized_keys しかし、[email protected]: Permission denied (publickey)gitユーザーとしてsshに接続しようとしたり、gitリポジトリにプッシュしようとするとエラーが発生します。 ノート:は/var/gitユーザーのホームディレクトリですgit。サーバーはDebian 11で実行されます。 各ユーザーに個別に接続できますが、なぜユーザーに接続できないのですかgit?

Admin

ローカルOSの更新/再インストール後にsshを使用できなくなりました:「一致するホストキータイプが見つかりません。対応する引用:ssh-rsa、ssh-dss」
ssh

ローカルOSの更新/再インストール後にsshを使用できなくなりました:「一致するホストキータイプが見つかりません。対応する引用:ssh-rsa、ssh-dss」

LinuxサーバーにSSHで接続します。新しいオペレーティングシステムを再インストールしてローカルLinuxオペレーティングシステムを更新する必要があります。以前に保存して~/.sshもう一度コピーしましたが、サーバーにSSHで接続しようとすると、次のような結果が表示されます。 Unable to negotiate with [server's IP] port 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss これにより、ssh -Q key結果にはとssh-rsaが含まれますssh-dss。 サーバーは古く、おそらく最新の状態ではない可能性が高いですが、それに対する制御はありません。 編集:そして、私は単に助けを求めるように設計されたサイトから助けを求めたという理由で反対表を受け取りました。少し驚いたと言えば嘘でしょう。これは、私がstackoverflowと過度のホールモニターの毒性の肯定的な解釈を決して尊重したり興味を持っていなかった理由です。

Admin

UFWは再起動時にiptablesをリセットしますか?
ssh
networking
iptables
firewall
ufw

UFWは再起動時にiptablesをリセットしますか?

ネットワーク設定を調整するためにリモートLinuxサーバーに接続しましたが、iptables好む方法の代わりにufw。 ルールを追加してufwからiptables -F、更新ルールを実行しましたiptables。しかし、これがSSH接続をブロックするという事実を忘れていました。 SSHを介してサーバーに再接続したいのですが、SSHに使用するポートは許可されていますが、リフレッシュのためにufw接続iptablesできません。 サーバー管理者にサーバーを手動で再起動するように要求した場合(たとえば、電源コードを切断して再接続する場合)、SSH接続を許可するように再構成されます(ルールに設定されているufwようiptablesにufw)、またはローカルTTYを介してサーバーにログインしてufw問題を解決します。するためにルールを再入力しますか?

Admin

webmstrssh 鍵認証にはまだパスワードが必要です。
ssh

webmstrssh 鍵認証にはまだパスワードが必要です。

こんにちは、私はサーバー間でパスワードのないSSH接続を作成しています。 keygenを介してキーを生成し、以下を介してリモートサーバーにコピーしました。 ssh-copy-id -i id_rsa.pub [email protected] ローカルシステム -bash-4.2$ ls -la total 24 drwx------. 2 webmstr webmstr 108 Aug 27 09:25 . drwxr-xr-x. 4 webmstr webmstr 4096 Aug 26 15:26 .. -rw-------. 1 webmstr webmstr 1202 Aug 25 10:43 authorized_keys -rw-------. 1 webmstr webmstr 1679 Dec 15 2020 id_rsa -rw-r--r--. 1 webmstr webmstr 411 Dec 15 2020 id_rsa.pub -rw-r--r--. 1 webmstr webmstr 2609 Aug 25 13:19 known_hosts -rw-r--r--. 1 webmstr webmstr 1211 Jun 30 10:13 known_hosts_06292021 -bash-4.2$ ssh-copy-id -i id_rsa.pub [email protected] /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "id_rsa.pub" /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys [email protected]'s password: Number of key(s) added: 1 Now try logging into the machine, with: "ssh '[email protected]'" and check to make sure that only the key(s) you wanted were added. -bash-4.2$ パスワードを求めるのにログインしようとすると、引き続きプロンプトが表示されます。 権限について読み、ホームディレクトリが700、.sshが700、認証キーが600であることを確認しましたが、まだパスワードプロンプトが表示されます。 リモートシステム(権限): [webmstr@ups-rhelmxi-14 home]$ ls -ld webmstr/ drwx------. 7 webmstr webmstr 4096 Aug 26 17:00 webmstr/ [webmstr@ups-rhelmxi-14 home]$ cd webmstr/ [webmstr@ups-rhelmxi-14 ~]$ ls -lad .ssh drwx------. 2 webmstr webmstr 98 Aug 27 07:40 .ssh [webmstr@ups-rhelmxi-14 ~]$ cd .ssh [webmstr@ups-rhelmxi-14 .ssh]$ ls -la total 20 drwx------. 2 webmstr webmstr 98 Aug 27 07:40 . drwx------. 7 webmstr webmstr 4096 Aug 26 17:00 .. -rw-------. 1 webmstr webmstr 1803 Aug 27 09:25 authorized_keys -rw-------. 1 webmstr webmstr 3102 Aug 26 16:23 authorized_keys_old -rw-r--r--. 1 webmstr webmstr 349 Aug 27 07:43 known_hosts -rw-r--r--. 1 webmstr webmstr 348 Aug 26 17:00 known_hosts_old [webmstr@ups-rhelmxi-14 .ssh]$ キーを何度も追加しようとしました。 ローカルシステムからリモートシステム192.168.1.241への詳細なSSH接続を作成するとき: -bash-4.2$ ssh [email protected] -vv OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 59: Applying options for * debug2: resolving "192.168.1.241" port 22 debug2: ssh_connect_direct: needpriv 0 debug1: Connecting to 192.168.1.241 [192.168.1.241] port 22. debug1: Connection established. debug1: identity file /home/webmstr/.ssh/id_rsa type 1 debug1: key_load_public: No such file or directory debug1: identity file /home/webmstr/.ssh/id_rsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /home/webmstr/.ssh/id_dsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /home/webmstr/.ssh/id_dsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /home/webmstr/.ssh/id_ecdsa type -1 debug1: key_load_public: No such file or directory debug1: identity file /home/webmstr/.ssh/id_ecdsa-cert type -1 debug1: key_load_public: No such file or directory debug1: identity file /home/webmstr/.ssh/id_ed25519 type -1 debug1: key_load_public: No such file or directory debug1: identity file /home/webmstr/.ssh/id_ed25519-cert type -1 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_7.4 debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4 debug1: match: OpenSSH_7.4 pat OpenSSH* compat 0x04000000 debug2: fd 3 setting O_NONBLOCK debug1: Authenticating to 192.168.1.241:22 as 'webmstr' debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug2: local client KEXINIT proposal debug2: KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1,ext-info-c debug2: host key algorithms: [email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected],[email protected],ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ssh-dss debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],aes128-cbc,aes192-cbc,aes256-cbc debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],aes128-cbc,aes192-cbc,aes256-cbc debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1 debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1 debug2: compression ctos: none,[email protected],zlib debug2: compression stoc: none,[email protected],zlib debug2: languages ctos: debug2: languages stoc: debug2: first_kex_follows 0 debug2: reserved 0 debug2: peer server KEXINIT proposal debug2: KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 debug2: host key algorithms: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519 debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],aes128-cbc,aes192-cbc,aes256-cbc,blowfish-cbc,cast128-cbc,3des-cbc debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],aes128-cbc,aes192-cbc,aes256-cbc,blowfish-cbc,cast128-cbc,3des-cbc debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1 debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1 debug2: compression ctos: none,[email protected] debug2: compression stoc: none,[email protected] debug2: languages ctos: debug2: languages stoc: debug2: first_kex_follows 0 debug2: reserved 0 debug1: kex: algorithm: curve25519-sha256 debug1: kex: host key algorithm: ecdsa-sha2-nistp256 debug1: kex: server->client cipher: [email protected] MAC: compression: none debug1: kex: client->server cipher: [email protected] MAC: compression: none debug1: kex: curve25519-sha256 need=64 dh_need=64 debug1: kex: curve25519-sha256 need=64 dh_need=64 debug1: expecting SSH2_MSG_KEX_ECDH_REPLY debug1: Server host key: ecdsa-sha2-nistp256 SHA256:HmLSkqaa9vDZQ85Yl/zv14Rk9/KVp/jsm4jiUMxUa2c debug1: Host '192.168.1.241' is known and matches the ECDSA host key. debug1: Found key in /home/webmstr/.ssh/known_hosts:4 debug2: set_newkeys: mode 1 debug1: rekey after 134217728 blocks debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug2: set_newkeys: mode 0 debug1: rekey after 134217728 blocks debug2: key: /home/webmstr/.ssh/id_rsa (0x55f4c98aba00) debug2: key: /home/webmstr/.ssh/id_dsa ((nil)) debug2: key: /home/webmstr/.ssh/id_ecdsa ((nil)) debug2: key: /home/webmstr/.ssh/id_ed25519 ((nil)) debug1: SSH2_MSG_EXT_INFO received debug1: kex_input_ext_info: server-sig-algs= debug2: service_accept: ssh-userauth debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password debug1: Next authentication method: gssapi-keyex debug1: No valid Key exchange context debug2: we did not send a packet, disable method debug1: Next authentication method: gssapi-with-mic debug1: Unspecified GSS failure. Minor code may provide more information No Kerberos credentials available (default cache: KEYRING:persistent:1001) debug1: Unspecified GSS failure. Minor code may provide more information No Kerberos credentials available (default cache: KEYRING:persistent:1001) debug2: we did not send a packet, disable method debug1: Next authentication method: publickey debug1: Offering RSA public key: /home/webmstr/.ssh/id_rsa debug2: we sent a publickey packet, wait for reply debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password debug1: Trying private key: /home/webmstr/.ssh/id_dsa debug1: Trying private key: /home/webmstr/.ssh/id_ecdsa debug1: Trying private key: /home/webmstr/.ssh/id_ed25519 debug2: we did not send a packet, disable method debug1: Next authentication method: password [email protected]'s password: リモートwebmstrホームディレクトリの権限を更新しました。 [webmstr@ups-rhelmxi-14 home]$ ls -la total 8 drwxr-xr-x. 4 root root 42 Apr 2 2020 . dr-xr-xr-x. 18 root root 239 Jan 6 2021 .. drwxr-xr-x. 5 administrator administrator 4096 Aug 13 16:06 administrator drwxr-x---. 7 webmstr webmstr 4096 Aug 27 10:27 webmstr [webmstr@ups-rhelmxi-14 home]$ ソースサーバーで試してみるとき: [dba@TS-MXIAppMon .ssh]$ ssh '[email protected]' [email protected]'s password:

Admin

ログインごとにssh rcコマンドが異なります。
linux
ssh
key-authentication

ログインごとにssh rcコマンドが異なります。

だから愚かな質問があります。さまざまなデバイスを使用して定期的にSSH経由で接続するLinuxサーバーがあります。私の.sshディレクトリにログインすると、いくつかのASCIIアートテキストを印刷する「rc」ファイルがあります。ただの装飾用です。他のすべてのコンピュータでは問題ありませんが、携帯電話にSSHクライアントがあり、すべてが混乱しています(フォーマットのため)。私の電話クライアントのための一般的なログインウェルカムメッセージを印刷したいと思います。私はssh設定の経験があまりないので、ECDSAキーフィンガープリントを介して別のsshログインで実行する別のコマンドを指定する方法があるかどうか疑問に思います。あまりないだけでやりたいことです。誰でも助けることができれば幸いです。

Admin

ssh
ssh-agent
dwm

"ssh-agent dwm" は .xinitrc で始まりますが、環境変数が設定されていません。

.xinitrc次の行を含むファイルを取得します。 # it will start my window manager ssh-agent dwm その後、プロセスを取得しましたが、端末で実行したときなどの ssh-agent環境変数は存在しませんでした。どんなアイデアがありますか?$SSH_AGENT_PID$SSH_AUTH_SOCKdwm プロセスが1つだけあったらと思いますssh-agent。各呼び出しはssh-add起動したエージェントに接続する必要がありますdwm。

Admin

nohupとdisownにもかかわらず、ログアウト時にプロセスが終了するのはなぜですか?
ssh
nohup
job-control
disown

nohupとdisownにもかかわらず、ログアウト時にプロセスが終了するのはなぜですか?

ログアウトした後も実行したい実行可能ファイル(Unityで作成したサーバー)があります。すべてのインターネットでは、nohupどちらか一方または両方を介してdisownこれを行うことができるはずです。しかし、これはうまくいきません。私は以下が欲しい: nohup /usr/bin/myexecutable & disown -h この時点でプロセスのリストを確認してみると、私のプロセスが実行されているのです。その後、exitsshで再度ログインしてプロセスリストを再確認しましたが、消えました。フラグを使用または使用せずdisown、フラグを使用または使用せずに試しましたが、-hシェルを終了するときにプロセスが消えるのを防ぐことはありません。 screenorを使用してこれを行うことはできますが、tmux技術的な知識のない従業員がログインして実行できる簡単な起動スクリプトを設定しようとしています。どんなアイデアがありますか? (私はUbuntu 16.04.6 LTSを実行しています。) 編集:誰かが提案しました。この問題しかし、@mathsyouthのコメントのようにdisown私には効果がありません。この質問に対する唯一の答えを書いた@Foxは、「使用中のプログラムがまだ終了し、シェルの終了時に拒否されれば、これは別の問題のようです」と述べました。 (上記のように、彼の使用提案はscreen私のユースケースには役に立ちませんでした。)

Admin

MACフィルタリングでSSHにiptablesを使用する - お勧めですか?
ssh
security
iptables
mac-address

MACフィルタリングでSSHにiptablesを使用する - お勧めですか?

内部ネットワーク(VPN経由でログイン)にサーバーがあり、そこからOpenSSH公開/秘密鍵認証を使用してSSH経由でサーバーにログインします。セキュリティの観点から、私はiptables私が使用した3つのクライアントのMACアドレスをサーバーを介してバインドし、そのクライアントだけがそれを使用してログインできるようにしたいと思います。 iptables -A INPUT -p tcp --destination-port 22 -m mac --mac-source xx:xx:xx:xx:xx:xx -j ACCEPT iptables -A INPUT -p tcp --destination-port 22 -j DROP しかし、これはお勧めですか? SSHログインを使用しているクライアントに接続するために使用できる他の(より良い)方法は何ですか? (誰かが2FAを要求したい場合は、残念ながら2FAは潜在的な解決策として使用できません。) ありがとうございます。

Admin

ポート転送(SSH)有効:ssh:ホストXXXXポートへの接続22:接続が拒否されました
ssh
port-forwarding

ポート転送(SSH)有効:ssh:ホストXXXXポートへの接続22:接続が拒否されました

家にいないときは、SSHを使ってコンピュータにリモートで接続したいと思います。 タイトルに書かれたXXXXが私のグローバルIPルーターであるとします。 次の手順を完了しました。 自宅のコンピュータにopenssh-serverをインストールします。 ポート 22 でルータのポート転送をイネーブルにします。 SSHサーバーを展開する前に、ルータでポート転送が有効になっていることを確認し、netcatを使用してポートをリッスンし、このオンラインツールを使用してテストしました。オープンポート検査ツール。ポートが開いているかどうかをテストするために、これは私のグローバルIPにいくつかのパケットを送信すると思いました。 次に、ポート22でリッスンするようにsshdデーモンを実行します。私はこれを実行しsudo ss -nlput | grep 22て確認しましたsudo service sshd status。 コンピュータファイアウォールがSSHパケットをブロックしていることを確認してください。 iptables 設定が一覧表示され、すべての入力、出力、転送が有効になっています。 sudo iptables -L: チェーン入力(ポリシーを受け入れる)ターゲットprot optソースターゲット Chain FORWARD(政策受付)対象 prot opt ソース対象 チェーン出力(ポリシー承認)ターゲットprot optソースターゲット 私の場合は、グローバルIPルーターを使用してどこからでも自分の自宅のコンピュータにssh接続を作成し、次のように "user"というLinuxユーザーを選択できます。[Eメール保護] 私が逃したステップはありますか?

Admin

SSHを使用する場合のホストベース認証のホスト名の問題
ssh
hostname

SSHを使用する場合のホストベース認証のホスト名の問題

これで、チームはSSH公開鍵認証を介してサーバーに接続できます。各チームメンバーは自分のPCに秘密鍵を持ち、~/.ssh/公開鍵はサーバー上のファイルにありますauthorized_key。 各チームメンバーに割り当てられたPCのみがサーバーへのSSH接続を承認するように要求されました。 実際、チームメンバーがそのコンピュータへのルートアクセス権を持っていなくても、理論的にはホームフォルダから秘密鍵をコピーし、別のコンピュータで使用してサーバーに接続できるようになりました。だから私の質問はこれを行う方法です。 私は多くの文書を読んで、私に最適なものが何であるかをテストしました。ホストベース認証。 これが私の問題に対する完璧な解決策のようです。各 PC には、非/etc/ssh/root ユーザーが読み取ることができず、既存の公開鍵認証構成に加えて認証をホストするために使用される秘密鍵があります。 私が経験している問題は、SSHクライアントがサーバーに送信するホスト名にあります。私が接続されているネットワークに従って送信されるホスト名が、、であることを確認fooMachine.localdomainしfooMachine.homeましたfooMachine。 使ってssh -vvv user@ipみると debug2: userauth_hostbased: chost ... これに注意してください。 PCが常に同じネットワーク上のSSHサーバーに接続されているわけではなく、VPNや固定IPはありません。 fooMachine.localdomainしたがって、これが意味するのは、SSHサーバーで何度も(、、、fooMachine.home)接続するようにホストを宣言する必要があり、fooMachineネットワークに接続した後に別のサフィックスを持つようになり、fooMachine接続できないことが発生する可能性があることです。私のサーバーに接続してください。 この問題をどのように解決できますか?それとも私が何か間違っているのでしょうか? fooMachine.test.com再起動後もhostname --fqdn表示されたSSHクライアントfooMachine.test.comで使用されるホスト名は同じですfooMachine.localdomain。 また、サーバーに接続するホストを宣言したSSHサーバーのshosts.equivファイルでワイルドカードを試しましたが、機能しませんでした。読んだ後ソースコードこれはワイルドカード(+rhostsスタイルファイルの場合)が無視されるため意味があります。

Admin