質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
CentOS

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

Webサーバー

Webサーバーとは、HTTPリクエストに応じて、クライアントに情報を提供するシステムです。

Q&A

解決済

1回答

2552閲覧

Shellinaboxですぐにセッションが閉じてしまう。(ログインできない)

j-suzuki

総合スコア50

CentOS

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

Webサーバー

Webサーバーとは、HTTPリクエストに応じて、クライアントに情報を提供するシステムです。

0グッド

0クリップ

投稿2017/01/30 09:47

CentOS6でサーバを構築しています。
その管理のためにShellinaboxを導入したいのですが、リバースプロキシ、SSHの設定をしたところログイン画面は見えるのですが、IDを入力するとSession closed. になってログインできません。
https://github.com/shellinabox/shellinabox/issues/88
このサイトの

From luka.kra...@gmail.com on January 12, 2015 13:16:45
For future readers :)

I had the same issue on my CentOS 6.6 and I found out that the code from shellinabox/launcher.c replaces "@localhost" in ssh command with "@hostname.domain" (output of command uname -n) ...

[luka@hostname shellinabox]$ uname -n
hostname.domain

This is quick patch that I am using (but than you missout on nice shell prompt):

diff --git a/shellinabox/launcher.c b/shellinabox/launcher.c
index 68d8862..3aa9100 100644
--- a/shellinabox/launcher.c
+++ b/shellinabox/launcher.c
@@ -1000,16 +1000,16 @@ static pam_handle_t *internalLogin(struct Service *service, struct Utmp *utmp,

// Replace '@localhost' with the actual host name. This results in a nicer // prompt when SSH asks for the password.
  • char *ptr = strrchr(cmdline, '@');
  • if (!strcmp(ptr + 1, "localhost")) {
  • int offset = ptr + 1 - cmdline;
  • check(cmdline = realloc(cmdline,
  • strlen(cmdline) + strlen(fqdn) -
  • strlen("localhost") + 1));
  • ptr = cmdline + offset;
  • *ptr = '\000';
  • strncat(ptr, fqdn, strlen(fqdn));
  • }
  • // char *ptr = strrchr(cmdline, '@');

  • // if (!strcmp(ptr + 1, "localhost")) {

  • // int offset = ptr + 1 - cmdline;

  • // check(cmdline = realloc(cmdline,

  • // strlen(cmdline) + strlen(fqdn) -

  • // strlen("localhost") + 1));

  • // ptr = cmdline + offset;

  • // *ptr = '\000';

  • // strncat(ptr, fqdn, strlen(fqdn));

  • // }

    free((void *)service->cmdline);
    service->cmdline = cmdline;

I think that the correct thing to do here is to configure host and domain name, but i didn't try that (/etc/hosts and /etc/resolv.conf) ...
これをすればいいのではとなったのですが、luncher.cが見つけられません。
#find / -name luncher.cで探しています。
どうしたらいいでしょうか?

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

granfa_yuzo

2017/01/30 22:32

tera term等他のツールでのログイン可否を確認して、原因が設定なのかShellinabox自体にあるのかを確認した方が良いと思いますが。
j-suzuki

2017/01/31 02:48

macOSでターミナルではログインできています
guest

回答1

0

ベストアンサー

Shell In A Boxをどのようにして導入したかが不明ですが、EPEL等からyumで導入したのでしたら見つからないと思います。

bash

1# rpm -ql shellinabox 2/etc/rc.d/init.d/shellinaboxd 3/etc/sysconfig/shellinaboxd 4/usr/sbin/shellinaboxd 5/usr/share/doc/shellinabox-2.19 6/usr/share/doc/shellinabox-2.19/AUTHORS 7/usr/share/doc/shellinabox-2.19/COPYING 8/usr/share/doc/shellinabox-2.19/GPL-2 9/usr/share/doc/shellinabox-2.19/NEWS 10/usr/share/doc/shellinabox-2.19/README 11/usr/share/doc/shellinabox-2.19/README.Fedora 12/usr/share/doc/shellinabox-2.19/print-styles.css 13/usr/share/doc/shellinabox-2.19/shell_in_a_box.js 14/usr/share/doc/shellinabox-2.19/styles.css 15/usr/share/man/man1/shellinaboxd.1.gz 16/usr/share/shellinabox 17/usr/share/shellinabox/color.css 18/usr/share/shellinabox/monochrome.css 19/usr/share/shellinabox/white-on-black.css 20/var/lib/shellinabox

もしSession closed too fast #88の方法を試すのであれば、Buildの方法に沿って、まずgitコマンドを使ってソースをダウンロードし、変更してコンパイルする必要があります。
gitコマンドでダウンロードすれば、以下のようにダウンロードしたディレクトリに出来たshellinabox/shellinaboxディレクトリにlauncher.cはあります。

bash

1$ cd /home/hogehoge 2$ git clone https://github.com/shellinabox/shellinabox.git 3$ find /home/hogehoge/shellinabox -name launcher.c 4/home/hogehoge/shellinabox/shellinabox/launcher.c

ちなみに、/etc/sysconfig/shellinaboxdOPTS=はデフォルトのままでしょうか?
下記のように変更したら、前述のソース変更などしなくても普通にログインできました。

bash

1#OPTS="--disable-ssl-menu -s /:LOGIN" 2OPTS="--localhost-only --disable-ssl --disable-ssl-menu -s /:SSH:localhost"

投稿2017/02/14 17:55

kanbeworks

総合スコア829

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問