AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-112079

George Reith's questions

Martin Hope
George Reith
Asked: 2013-12-14 16:49:23 +0800 CST

bash 脚本创建用户然后创建 ssh 密钥

  • 0

请注意,我是一个完全的 linux 新手,在回答这个问题时请记住这一点,因为我对 linux 的了解非常有限。

操作系统: Debian 挤压

我正在使用 ZSH 并创建了一个名为webuseradd它的函数,如下所示:

function webuseradd () {
    echo creating user $1;
    mkdir /usr/share/nginx/$1;

    # sshlogin is required to allow user to ssh and sftp
    sudo useradd -G lshell,sshlogin -b /usr/share/nginx/$1/home -d /usr/share/nginx/$1/home -m --skel /etc/httpskel -K UMASK=027 $1;

    # /usr/share/nginx/$1 will be the chroot so set it to root
    sudo chown root:root /usr/share/nginx/$1;
    sudo su - $1;
    mkdir /usr/share/nginx/$1/home/.ssh;
    ssh-keygen -t rsa;
    exit;

    # force the user into a limited, jailed shell
    sudo chsh -s /usr/bin/lshell $1;
}

但是,如果我称之为它,我得到的输出:

$ webuseradd test
creating user test
No directory, logging in with HOME=/

用户创建得很好,但是当我尝试su进入用户时出现问题。如果我exit脚本然后继续以下输出:

Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):

如何确保创建密钥并将其放置在具有正确权限的正确位置?我确信我所做的其他一些事情是不可取的,所以如果你发现任何事情,请说。

debian
  • 2 个回答
  • 4009 Views
Martin Hope
George Reith
Asked: 2013-04-08 06:35:30 +0800 CST

SFTP 用户不能编辑或创建文件

  • 6

服务器:Ubuntu 12.04 LTS

我正在使用 openSSH 并创建了一个名为bobwho belongs to group的 SFTP 用户sftponly。我已将 bob chroot 到他的主目录,即/usr/share/nginx/www/bob/.

bob 能够通过 SFTP 连接到服务器并查看主目录,但是他无法编辑目录中的文件。我已经跑去chown -R bob /usr/share/nginx/www/bob/*让 bob 成为他的文件的所有者,但他仍然无法编辑它们。

为什么会这样?

linux
  • 1 个回答
  • 8112 Views
Martin Hope
George Reith
Asked: 2012-06-15 12:38:51 +0800 CST

清漆,隐藏端口号

  • 3

我的设置如下:

操作系统:在 OpenVZ 虚拟机上运行的 CentOS 6.2。

Web 服务器: Nginx 监听 8080 端口

反向代理: Varnish 监听 80 端口

问题是 Varnish 将我的请求重定向到端口 8080,并且它像这样出现在地址栏中http://mysite.com:8080/directory/,导致站点上的相关链接在请求中包含端口号 (8080),从而绕过 Varnish。

该网站由 WordPress 提供支持。

如何允许 Varnish 在端口 8080 上使用 Nginx 作为后端而不将端口号附加到地址?

编辑:清漆设置如下:

我已经告诉 Varnish 守护进程默认监听端口 80。

VARNISH_VCL_CONF=/etc/varnish/default.vcl
#
# # Default address and port to bind to
# # Blank address means all IPv4 and IPv6 interfaces, otherwise specify
# # a host name, an IPv4 dotted quad, or an IPv6 address in brackets.
# VARNISH_LISTEN_ADDRESS=
VARNISH_LISTEN_PORT=80
#
# # Telnet admin interface listen address and port
VARNISH_ADMIN_LISTEN_ADDRESS=127.0.0.1
VARNISH_ADMIN_LISTEN_PORT=6082
#
# # Shared secret file for admin interface
VARNISH_SECRET_FILE=/etc/varnish/secret
#
# # The minimum number of worker threads to start
VARNISH_MIN_THREADS=1
#
# # The Maximum number of worker threads to start
VARNISH_MAX_THREADS=1000
#
# # Idle timeout for worker threads
VARNISH_THREAD_TIMEOUT=120
#
# # Cache file location
VARNISH_STORAGE_FILE=/var/lib/varnish/varnish_storage.bin
#
# # Cache file size: in bytes, optionally using k / M / G / T suffix,
# # or in percentage of available disk space using the % suffix.
VARNISH_STORAGE_SIZE=1G
#
# # Backend storage specification
VARNISH_STORAGE="file,${VARNISH_STORAGE_FILE},${VARNISH_STORAGE_SIZE}"
#
# # Default TTL used when the backend does not specify one
VARNISH_TTL=120

Varnish 调用的 VCL 文件(通过 include in default.vcl)包括:

backend playwithbits {
     .host = "127.0.0.1";
     .port = "8080";
}
acl purge {
     "127.0.0.1";
}
sub vcl_recv {
     if (req.http.Host ~ "^(.*\.)?playwithbits\.com$") {
          set req.backend = playwithbits;
          set req.http.Host = regsub(req.http.Host, ":[0-9]+", ""); 
          if (req.request == "PURGE") {
               if (!client.ip ~ purge) {
                    error 405 "Not allowed.";
               }
               return(lookup);
          }
          if (req.url ~ "^/$") {
               unset req.http.cookie;
          }
     }
}
sub vcl_hit {
     if (req.http.Host ~ "^(.*\.)?playwithbits\.com$") {
          if (req.request == "PURGE") {
               set obj.ttl = 0s;
                    error 200 "Purged.";
          }
     }
}
sub vcl_miss {
     if (req.http.Host ~ "^(.*\.)?playwithbits\.com$") {
          if (req.request == "PURGE") {
               error 404 "Not in cache.";
          } 
          if (!(req.url ~ "wp-(login|admin)")) {
               unset req.http.cookie;
          }
          if (req.url ~ "^/[^?]+.(jpeg|jpg|png|gif|ico|js|css|txt|gz|zip|lzma|bz2|tgz|tbz|html|htm)(\?.|)$") {
               unset req.http.cookie;
               set req.url = regsub(req.url, "\?.$", "");
          }
          if (req.url ~ "^/$") {
               unset req.http.cookie;
          }
     }
}
sub vcl_fetch {
     if (req.http.Host ~ "^(.*\.)?playwithbits\.com$") {
          if (req.url ~ "^/$") {
               unset beresp.http.set-cookie;
          }
          if (!(req.url ~ "wp-(login|admin)")) {
               unset beresp.http.set-cookie;
          }
     }
}
linux centos port nginx varnish
  • 4 个回答
  • 2276 Views
Martin Hope
George Reith
Asked: 2012-06-15 02:41:22 +0800 CST

自定义 VCL 阻止清漆启动

  • 3

操作系统: CentOS 6 (x86_64)

我已经安装并配置了清漆,但它现在无法启动。

# service varnish restart
Stopping Varnish Cache:                                    [FAILED]
Starting Varnish Cache:                                    [FAILED]

我已将此错误缩小到在/etc/varnish/default.vcl.

我像这样包含 VCL:

include "/etc/varnish/domains/playwithbits.vcl";

如果我清空其中的内容,playwithbits.vcl那么 varnish 就可以启动,但是一旦我添加内容,它就会失败。

我的内容playwithbits.vcl是:

backend playwithbits {
     .host = "localhost";
     .port = "8080";
}
acl purge {
     if (req.http.Host ~ "playwithbits.com") {
          "localhost";
     }
}
sub vcl_recv {
     if (req.http.Host ~ "playwithbits.com") {
          set req.backend = playwithbits; 
          if (req.request == "PURGE") {
               if (!client.ip ~ purge) {
                    error 405 "Not allowed.";
               }
               return(lookup);
          }
          if (req.url ~ "^/$") {
               unset req.http.cookie;
          }
     }
}
sub vcl_hit {
     if (req.http.Host ~ "playwithbits.com") {
          if (req.request == "PURGE") {
               set obj.ttl = 0s;
                    error 200 "Purged.";
          }
     }
}
sub vcl_miss {
     if (req.http.Host ~ "playwithbits.com") {
          if (req.request == "PURGE") {
               error 404 "Not in cache.";
          } 
          if (!(req.url ~ "wp-(login|admin)")) {
               unset req.http.cookie;
          }
          if (req.url ~ "^/[^?]+.(jpeg|jpg|png|gif|ico|js|css|txt|gz|zip|lzma|bz2|tgz|tbz|html|htm)(\?.|)$") {
               unset req.http.cookie;
               set req.url = regsub(req.url, "\?.$", "");
          }
          if (req.url ~ "^/$") {
               unset req.http.cookie;
          }
     }
}
sub vcl_fetch {
     if (req.http.Host ~ "playwithbits.com") {
          if (req.url ~ "^/$") {
               unset beresp.http.set-cookie;
          }
          if (!(req.url ~ "wp-(login|admin)")) {
               unset beresp.http.set-cookie;
          }
     }
}

这是输出# strace -e trace=file service varnish start

execve("/sbin/service", ["service", "varnish", "start"], [/* 20 vars */]) = 0
access("/etc/ld.so.preload", R_OK)      = 0
open("/etc/ld.so.preload", O_RDONLY)    = 3
open("/etc/ld.so.cache", O_RDONLY)      = 3
open("/lib64/libtinfo.so.5", O_RDONLY)  = 3
open("/lib64/libdl.so.2", O_RDONLY)     = 3
open("/lib64/libc.so.6", O_RDONLY)      = 3
open("/dev/tty", O_RDWR|O_NONBLOCK)     = 3
open("/usr/lib/locale/locale-archive", O_RDONLY) = 3
open("/proc/meminfo", O_RDONLY)         = 3
stat("/etc/varnish", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat(".", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/usr/lib64/gconv/gconv-modules.cache", O_RDONLY) = 3
open("/sbin/service", O_RDONLY)         = 3
open("/etc/init.d/functions", O_RDONLY) = 3
--- SIGCHLD (Child exited) @ 0 (0) ---
stat("/etc/sysconfig/i18n", {st_mode=S_IFREG|0644, st_size=47, ...}) = 0
open("/dev/null", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
open("/etc/profile.d/lang.sh", O_RDONLY) = 3
stat("/root/.i18n", 0x7fff831f79e0)     = -1 ENOENT (No such file or directory)
stat("/etc/sysconfig/init", {st_mode=S_IFREG|0644, st_size=1153, ...}) = 0
open("/etc/sysconfig/init", O_RDONLY)   = 3
open("/usr/share/locale/locale.alias", O_RDONLY) = 3
open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/initscripts.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US.utf8/LC_MESSAGES/initscripts.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US/LC_MESSAGES/initscripts.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.UTF-8/LC_MESSAGES/initscripts.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.utf8/LC_MESSAGES/initscripts.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/initscripts.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
--- SIGCHLD (Child exited) @ 0 (0) ---
--- SIGCHLD (Child exited) @ 0 (0) ---
chdir("/")                              = 0
stat("/etc/init.d/varnish", {st_mode=S_IFREG|0755, st_size=2837, ...}) = 0
stat(".", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat("/sbin/env", 0x7fff831f8960)       = -1 ENOENT (No such file or directory)
stat("/usr/sbin/env", 0x7fff831f8960)   = -1 ENOENT (No such file or directory)
stat("/bin/env", {st_mode=S_IFREG|0755, st_size=23832, ...}) = 0
stat("/bin/env", {st_mode=S_IFREG|0755, st_size=23832, ...}) = 0
access("/bin/env", X_OK)                = 0
stat("/bin/env", {st_mode=S_IFREG|0755, st_size=23832, ...}) = 0
access("/bin/env", R_OK)                = 0
stat("/bin/env", {st_mode=S_IFREG|0755, st_size=23832, ...}) = 0
stat("/bin/env", {st_mode=S_IFREG|0755, st_size=23832, ...}) = 0
access("/bin/env", X_OK)                = 0
stat("/bin/env", {st_mode=S_IFREG|0755, st_size=23832, ...}) = 0
access("/bin/env", R_OK)                = 0
Starting Varnish Cache:                                    [FAILED]
--- SIGCHLD (Child exited) @ 0 (0) ---

有谁知道这个问题是什么?

解决方案:

问题在于以下块:

acl purge {
         if (req.http.Host ~ "playwithbits.com") {
              "localhost";
         }
    }

acl purge只能取字符串作为值,所以if无效。替换为:

acl purge {
        "localhost";
        } 

它就像一个魅力。

linux centos service 64-bit varnish
  • 1 个回答
  • 4223 Views
Martin Hope
George Reith
Asked: 2012-06-14 13:33:52 +0800 CST

非标准端口上的 Nginx 虚拟主机无法正常工作

  • 2

我正在尝试使用清漆作为 Nginx 的前端代理。

当我尝试使用以下内容作为我的虚拟主机配置时:

server {
  listen 8080;
  server_name playwithbits.com  www.playwithbits.com;

  # limit_conn limit_per_ip 16;
  # ssi  on;

  access_log /home/nginx/domains/playwithbits/log/access.log combined buffer=32k;
  error_log /home/nginx/domains/playwithbits/log/error.log;

  root /home/nginx/domains/playwithbits/public;

  location / {

  # Enables directory listings when index file not found
  #autoindex  on;

  # Shows file listing times as local time
  #autoindex_localtime on;

  # Enable for vBulletin usage WITHOUT vbSEO installed
  #try_files             / /index.php;

  }

  include /usr/local/nginx/conf/staticfiles.conf;
  include /usr/local/nginx/conf/php.conf;
  include /usr/local/nginx/conf/drop.conf;
  #include /usr/local/nginx/conf/errorpage.conf;
}

但是,当我指定listen 8080并重定向到默认的 nginx web 根目录(如 中指定的virtual.conf)时,这将停止工作,如果我删除该行,它将按预期工作并重定向到正确的目录。

有谁知道为什么会这样,以及我如何为我的虚拟主机设置一个非标准端口,以便清漆可以在端口 80 上侦听。

linux centos nginx varnish
  • 1 个回答
  • 660 Views
Martin Hope
George Reith
Asked: 2012-06-11 13:00:18 +0800 CST

内核似乎没有模块

  • 4

有用信息:

OS: CentOS 5.8 final
Kernel: 2.6.32-042stab056.8

我的内核是用服务器预构建的,我对内核一无所知,对 linux 也不了解,但据我所知,我应该让内核加载一些模块。

我遇到这个问题是因为我无法运行iscsi,因为它期望加载某些模块。

lsmod什么都不返回。

depmod -a回报:

WARNING: Couldn't open directory /lib/modules/2.6.32-042stab056.8: No such file or directory
FATAL: Could not open /lib/modules/2.6.32-042stab056.8/modules.dep.temp for writing: No such file or directory

我已经重新启动,没有任何改变。

有谁知道为什么会这样?

linux centos kernel
  • 1 个回答
  • 8130 Views
Martin Hope
George Reith
Asked: 2012-06-11 06:10:35 +0800 CST

无法启动 auditd

  • 5

我在 CentOS 5.8 final

我最近安装了auditdviayum install audit但是我无法启动它。

我编辑了配置文件以提供启动时收到的错误的详细输出,这是输出:

# service auditd start
Starting auditd: Config file /etc/audit/auditd.conf opened for parsing
log_file_parser called with: /var/log/audit/audit.log
log_format_parser called with: RAW
log_group_parser called with: root
priority_boost_parser called with: 4
flush_parser called with: INCREMENTAL
freq_parser called with: 20
num_logs_parser called with: 4
qos_parser called with: lossy
dispatch_parser called with: /sbin/audispd
name_format_parser called with: NONE
max_log_size_parser called with: 5
max_log_size_action_parser called with: ROTATE
space_left_parser called with: 75
space_action_parser called with: SYSLOG
action_mail_acct_parser called with: root
admin_space_left_parser called with: 50
admin_space_left_action_parser called with: SUSPEND
disk_full_action_parser called with: SUSPEND
disk_error_action_parser called with: SUSPEND
tcp_listen_queue_parser called with: 5
tcp_max_per_addr_parser called with: 1
tcp_client_max_idle_parser called with: 0
enable_krb5_parser called with: no
GSSAPI support is not enabled, ignoring value at line 30
krb5_principal_parser called with: auditd
GSSAPI support is not enabled, ignoring value at line 31
Started dispatcher: /sbin/audispd pid: 3097
type=DAEMON_START msg=audit(1339336882.187:9205): auditd start, ver=1.8 format=raw kernel=2.6.32-042stab056.8 auid=4294967295 pid=3095 res=success
config_manager init complete
Error setting audit daemon pid (Connection refused)
type=DAEMON_ABORT msg=audit(1339336882.189:9206): auditd error halt, auid=4294967295 pid=3095 res=failed
Unable to set audit pid, exiting
The audit daemon is exiting.
Error setting audit daemon pid (Connection refused)
                                                           [FAILED]

我可以在网上找到的唯一信息是这可能是由于 SELinux,但是 SELinux 给我带来了它自己的问题。无论我做什么,它似乎都被禁用了(我想启用它)。配置设置为enforced并且服务器已重新启动多次但sestatus仍然返回SELinux status: disabled。

谁能阐明这个问题?

编辑:我不知道它是否相关,但我注意到以下消息出现在我的/var/log/messages

Jun 10 16:25:22 s1 iscsid: iSCSI logger with pid=2056 started!
Jun 10 16:25:22 s1 iscsid: Missing or Invalid version from /sys/module/scsi_transport_iscsi/version. Make sure a up to date scsi_transport_iscsi module is loaded and a up todate version of iscsid is running. Exiting...

我尝试自己启动 iSCSI 守护进程(我不知道它的作用;我是 Linux 新手),但出现以下错误:

Starting iSCSI daemon: FATAL: Could not load /lib/modules/2.6.32-042stab056.8/modules.dep: No such file or directory
FATAL: Could not load /lib/modules/2.6.32-042stab056.8/modules.dep: No such file or directory
FATAL: Could not load /lib/modules/2.6.32-042stab056.8/modules.dep: No such file or directory
FATAL: Could not load /lib/modules/2.6.32-042stab056.8/modules.dep: No such file or directory
FATAL: Could not load /lib/modules/2.6.32-042stab056.8/modules.dep: No such file or directory
                                                           [FAILED]

如果我去,/lib/modules/我注意到该目录存在但完全是空的。

linux centos audit selinux
  • 2 个回答
  • 12025 Views
Martin Hope
George Reith
Asked: 2012-06-09 04:48:09 +0800 CST

Wordpress 找不到 ssh 公钥和私钥对

  • 4

我的服务器配置如下:CentOS 5.8 (final) running Nginx。

我正在使用 Wordpress 插件安装程序的 SSH2 功能。

我已经安装lib2ssh并且可以正常工作(Wordpress 承认它存在)。

我提供给 wordpress的用户(称为playwithbits)是 chroot 并且具有主目录/home/nginx/domains/playwithbits/

公钥和私钥位于目录/home/nginx/domains/playwithbits/keys/中,分别命名为id_rsa.pub和id_rsa。

我已将 的内容复制id_rsa.pub到authorized_keys 位于/home/nginx/domains/playwithbits/.ssh/

我没有为密钥文件设置密码。但是 Wordpress 不断返回错误:

playwithbits 的公钥和私钥不正确

我已经向 Wordpress 提供了以下信息

Hostname: localhost
Username: playwithbits
Password: Blank
Public key: /keys/id_rsa.pub //I have also tried the paths from server root
Private key: /keys/id_rsa

以下是我对相关文件夹和文件设置的权限:

drwx------ 2 playwithbits playwithbits 4096 Jun  8 11:25 .ssh
drwx------ 2 playwithbits playwithbits 4096 Jun  8 13:27 keys
-rw------- 1 playwithbits playwithbits  414 Jun  8 11:21 authorized_keys
-rw------- 1 playwithbits playwithbits 1.7K Jun  6 02:17 id_rsa
-rw-r--r-- 1 playwithbits playwithbits  414 Jun  6 02:17 id_rsa.pub

我还尝试在调试模式下进行连接,在该模式下我得到以下输出:

Connection from 127.0.0.1 port 56674
debug1: Client protocol version 2.0; client software version libssh2_0.18 PHP
debug1: no match: libssh2_0.18 PHP
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.8
debug1: permanently_set_uid: 74/74
debug1: list_hostkey_types: ssh-rsa,ssh-dss
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: client->server aes256-cbc hmac-sha1 none
debug1: kex: server->client aes256-cbc hmac-sha1 none
debug1: expecting SSH2_MSG_KEXDH_INIT
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: KEX done
Received disconnect from 127.0.0.1: 11: PECL/ssh2 (http://pecl.php.net/packages/ssh2)
debug1: do_cleanup
debug1: do_cleanup

有谁知道为什么我不能使用公钥和私钥访问?如果我使用该帐户的密码,wordpress 将能够登录并执行更新。

编辑:在我的sshd_config文件中,我有以下规则:

Match group web-root-locked
         ChrootDirectory /home/nginx/domains/%u
         X11Forwarding no
         AllowTcpForwarding no
         ForceCommand internal-sftp
         AuthorizedKeysFile /home/nginx/domains/%u/.ssh/authorized_keys

playwithbits是的成员web-root-locked

linux ssh sftp wordpress ssh-keys
  • 4 个回答
  • 4324 Views
Martin Hope
George Reith
Asked: 2012-06-06 15:10:33 +0800 CST

Nginx 海量error.log,我是不是被DDOS了?

  • -2

所以我打开了我的 Nginx 错误日志,因为我所有的页面都抛出错误代码 500。

这是巨大的,我的网站仍在开发中,他们的资源错误超过 100k Nginx 无法找到所有带有垃圾名称的资源,就像有人在使用某种字典试图连接到我网站上的大量随机页面。

这是 DDO 攻击还是我遗漏了什么,我怎样才能阻止这个人再次连接?它们都来自 66.249.73 范围内的 IP。*

security spam nginx ddos
  • 2 个回答
  • 274 Views
Martin Hope
George Reith
Asked: 2012-06-05 06:09:57 +0800 CST

chrooting 用户在使用 sftp 时导致“连接关闭”消息

  • 5

首先,我是一个 Linux 新手,所以请不要假设太多知识。我正在使用 CentOS 5.8(最终版)并使用 OpenSSH 版本 5.8p1。

我已经创建了一个用户playwithbits,我正在尝试将chroot他们带到该目录home/nginx/domains/playwithbits/public

我在我的文件中使用以下match语句:sshd_config

Match group web-root-locked
         ChrootDirectory /home/nginx/domains/%u/public
         X11Forwarding no
         AllowTcpForwarding no
         ForceCommand /usr/libexec/openssh/sftp-server

# id playwithbits回报:uid=504(playwithbits) gid=504(playwithbits) groups=504(playwithbits),507(web-root-locked)

我已将用户的主目录更改为:home/nginx/domains/playwithbits/public

现在,当我尝试通过 sftp 连接到该用户时,我会立即收到消息:connection closed

有谁知道我做错了什么?

编辑:根据@Dennis Williamson 的建议,我已在调试模式下进行连接(我想……如果我错了请纠正我)。

通过使用直接将所有文件的权限递归设置为 700,我取得了一些进展chmod。现在我在尝试登录时收到以下消息(仍然连接被拒绝):

Connection from [My ip address] port 38737
debug1: Client protocol version 2.0; client software version OpenSSH_5.6
debug1: match: OpenSSH_5.6 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.8
debug1: permanently_set_uid: 74/74
debug1: list_hostkey_types: ssh-rsa,ssh-dss
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST received
debug1: SSH2_MSG_KEX_DH_GEX_GROUP sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_INIT
debug1: SSH2_MSG_KEX_DH_GEX_REPLY sent
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: KEX done
debug1: userauth-request for user playwithbits service ssh-connection method none
debug1: attempt 0 failures 0
debug1: user playwithbits matched group list web-root-locked at line 91
debug1: PAM: initializing for "playwithbits"
debug1: PAM: setting PAM_RHOST to [My host info]
debug1: PAM: setting PAM_TTY to "ssh"
debug1: userauth-request for user playwithbits service ssh-connection method password
debug1: attempt 1 failures 0
debug1: PAM: password authentication accepted for playwithbits
debug1: do_pam_account: called
Accepted password for playwithbits from [My ip address] port 38737 ssh2
debug1: monitor_child_preauth: playwithbits has been authenticated by privileged process
debug1: SELinux support disabled
debug1: PAM: establishing credentials
User child is on pid 3942
debug1: PAM: establishing credentials
Changed root directory to "/home/nginx/domains/playwithbits/public"
debug1: permanently_set_uid: 504/504
debug1: Entering interactive session for SSH2.
debug1: server_init_dispatch_20
debug1: server_input_channel_open: ctype session rchan 0 win 2097152 max 32768
debug1: input_session_request
debug1: channel 0: new [server-session]
debug1: session_new: session 0
debug1: session_open: channel 0
debug1: session_open: session 0: link with channel 0
debug1: server_input_channel_open: confirm session
debug1: server_input_global_request: rtype [email protected] want_reply 0
debug1: server_input_channel_req: channel 0 request env reply 0
debug1: session_by_channel: session 0 channel 0
debug1: session_input_channel_req: session 0 req env
debug1: server_input_channel_req: channel 0 request subsystem reply 1
debug1: session_by_channel: session 0 channel 0
debug1: session_input_channel_req: session 0 req subsystem
subsystem request for sftp by user playwithbits
debug1: subsystem: cannot stat /usr/libexec/openssh/sftp-server: Permission denied
debug1: subsystem: exec() /usr/libexec/openssh/sftp-server
debug1: Forced command (config) '/usr/libexec/openssh/sftp-server'
debug1: session_new: session 0
debug1: Received SIGCHLD.
debug1: session_by_pid: pid 3943
debug1: session_exit_message: session 0 channel 0 pid 3943
debug1: session_exit_message: release channel 0
debug1: session_by_channel: session 0 channel 0
debug1: session_close_by_channel: channel 0 child 0
debug1: session_close: session 0 pid 0
debug1: channel 0: free: server-session, nchannels 1
Received disconnect from [My ip address]: 11: disconnected by user
debug1: do_cleanup
debug1: do_cleanup
debug1: PAM: cleanup
debug1: PAM: closing session
debug1: PAM: deleting credentials
linux centos ssh sftp chroot
  • 2 个回答
  • 19383 Views
Martin Hope
George Reith
Asked: 2012-05-10 10:12:46 +0800 CST

无法通过 SSH 连接到 VPS(超时)

  • 2

我今天早些时候能够通过 SSH 连接到我的 VPS,并且没有做任何重大更改。但是现在,当我尝试通过 SSH 连接到我的 VPS 时,它甚至没有询问我的密码,它只是超时了。

如果我打开串行控制台并尝试通过本地主机进行 SSH,它工作正常。我还 ping 了我的主机名和 IP 地址,这两个都显示服务器已启动。

有谁知道这可能是什么原因造成的?

ssh timeout vps
  • 1 个回答
  • 5665 Views
Martin Hope
George Reith
Asked: 2012-05-09 04:21:39 +0800 CST

VPS中更改SSHD端口无法登录

  • 1

我将非托管 CentOS VPS 上的 SSHD 端口更改为0062,现在我无法通过 SSH 登录并收到错误:Network error: connection refused。

有谁知道如何进入并解决这个问题?为什么将端口更改为此会阻止我连接?

注意:VPS 是在外部托管的

centos ssh vps
  • 4 个回答
  • 1751 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve