我正在寻找一种不弃用的方式来运行命令,例如netstat -tulpn | grep 8000
输出有关活动端口的信息。关于如何使用诸如ss
获取进程ID之类的工具的任何建议?
我有一个 localhost 在端口 8000 上运行,但ss -a | grep 8000
不输出任何内容。运行fuser 8000/tcp
输出端口的进程,netstat -tulpn | grep 8000
. 为什么ss
命令没有输出任何关于我的端口的信息?
我正在寻找一种不弃用的方式来运行命令,例如netstat -tulpn | grep 8000
输出有关活动端口的信息。关于如何使用诸如ss
获取进程ID之类的工具的任何建议?
我有一个 localhost 在端口 8000 上运行,但ss -a | grep 8000
不输出任何内容。运行fuser 8000/tcp
输出端口的进程,netstat -tulpn | grep 8000
. 为什么ss
命令没有输出任何关于我的端口的信息?
我有一个在端口 5005 上运行的程序,该端口正在侦听并可通过 localhost 访问:
znc-admin:~/.znc$ netstat -tulpn | grep 5005
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 0.0.0.0:5005 0.0.0.0:* LISTEN 25476/znc
znc-admin:~/.znc$ wget -p http://localhost:5005
--2014-11-26 11:25:21-- http://localhost:5005/
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:5005... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1790 (1.7K) [text/html]
Saving to: `localhost:5005/index.html'
100%[===================================================>] 1,790 --.-K/s in 0s
2014-11-26 11:25:21 (155 MB/s) - `localhost:5005/index.html' saved [1790/1790]
Loading robots.txt; please ignore errors.
--2014-11-26 11:25:21-- http://localhost:5005/robots.txt
Connecting to localhost (localhost)|127.0.0.1|:5005... connected.
HTTP request sent, awaiting response... 200 OK
Length: 26 [text/plain]
Saving to: `localhost:5005/robots.txt'
100%[===================================================>] 26 --.-K/s in 0s
2014-11-26 11:25:21 (2.87 MB/s) - `localhost:5005/robots.txt' saved [26/26]
FINISHED --2014-11-26 11:25:21--
Total wall clock time: 0.01s
Downloaded: 2 files, 1.8K in 0s (88.2 MB/s)
不幸的是,该端口似乎从这个端口转发测试网站关闭:http ://www.yougetsignal.com/tools/open-ports/
并且页面http://<my ip>:5005
在我的浏览器中超时。
这让我发疯,我错过了什么?
我相信我的远程实例上的端口 80 被阻止了,我正在尝试使用端口 80 运行 node.js 应用程序。我已经尝试了端口 3000 和 3002,两个端口都工作正常,但是运行时出现错误在端口 80 上。我怀疑端口 80 被我的下面的输出阻止了netstat -an
,但是我怎样才能找到阻止下面端口 80 的地址的进程 ID?
[lucas@ecoinstance]~/node/nodetest1$ netstat -an
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 127.0.0.1:27017 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:3002 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:27017 127.0.0.1:51108 ESTABLISHED
tcp 0 0 127.0.0.1:51106 127.0.0.1:27017 ESTABLISHED
tcp 0 0 127.0.0.1:27017 127.0.0.1:51106 ESTABLISHED
tcp 0 0 127.0.0.1:51107 127.0.0.1:27017 ESTABLISHED
tcp 0 0 10.240.241.116:3002 174.61.171.61:36583 TIME_WAIT
tcp 0 0 127.0.0.1:27017 127.0.0.1:51109 ESTABLISHED
tcp 0 0 10.240.241.116:42423 169.254.169.254:80 ESTABLISHED
tcp 0 0 127.0.0.1:51108 127.0.0.1:27017 ESTABLISHED
tcp 0 532 10.240.241.116:22 174.61.171.61:56824 ESTABLISHED
tcp 0 0 127.0.0.1:27017 127.0.0.1:51107 ESTABLISHED
tcp 0 0 10.240.241.116:42412 169.254.169.254:80 ESTABLISHED
tcp 0 0 127.0.0.1:51109 127.0.0.1:27017 ESTABLISHED
tcp 0 0 127.0.0.1:51105 127.0.0.1:27017 ESTABLISHED
tcp 0 0 10.240.241.116:42422 169.254.169.254:80 TIME_WAIT
tcp 0 0 127.0.0.1:27017 127.0.0.1:51105 ESTABLISHED
tcp6 0 0 :::22 :::* LISTEN
udp 0 0 0.0.0.0:49948 0.0.0.0:*
udp 0 0 0.0.0.0:68 0.0.0.0:*
udp 0 0 10.240.241.116:123 0.0.0.0:*
udp 0 0 127.0.0.1:123 0.0.0.0:*
udp 0 0 0.0.0.0:123 0.0.0.0:*
udp6 0 0 :::12151 :::*
udp6 0 0 :::123 :::*
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags Type State I-Node Path
unix 2 [ ACC ] STREAM LISTENING 405680 /tmp/ssh-KdkxJfFLpKTC/agent.22
813
unix 2 [ ACC ] STREAM LISTENING 408230 /tmp/ssh-ofUeNNEwAqtP/agent.22
243
unix 2 [ ACC ] STREAM LISTENING 416227 /tmp/mongodb-27017.sock
unix 2 [ ACC ] SEQPACKET LISTENING 3692 /run/udev/control
unix 7 [ ] DGRAM 5286 /dev/log
unix 2 [ ACC ] STREAM LISTENING 5318 /var/run/acpid.socket
unix 2 [ ACC ] STREAM LISTENING 16170 /tmp//tmux-1000/default
unix 2 [ ACC ] STREAM LISTENING 414450 /var/run/dbus/system_bus_socke
这是尝试使用 node.js 在端口 80 上运行时的日志:
[lucas@ecoinstance]~/node/nodetest1$ npm start
> [email protected] start /home/lucas/node/nodetest1
> node ./bin/www
events.js:72
throw er; // Unhandled 'error' event
^
Error: listen EACCES
at errnoException (net.js:904:11)
at Server._listen2 (net.js:1023:19)
at listen (net.js:1064:10)
at Server.listen (net.js:1138:5)
at Function.app.listen (/home/lucas/node/nodetest1/node_modules/express/lib/applicati
on.js:532:24)
at Object.<anonymous> (/home/lucas/node/nodetest1/bin/www:7:18)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
npm ERR! [email protected] start: `node ./bin/www`
npm ERR! Exit status 8
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is most likely a problem with the nodetest1 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./bin/www
npm ERR! You can get their info via:
npm ERR! npm owner ls nodetest1
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.13-0.bpo.1-amd64
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! cwd /home/lucas/node/nodetest1
npm ERR! node -v v0.10.28
npm ERR! npm -v 1.4.9
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/lucas/node/nodetest1/npm-debug.log
npm ERR! not ok code 0
并且sudo netstat -lnp
不返回任何匹配的 80 端口:
[lucas@ecoinstance]~/node/nodetest1$ sudo netstat -lnp [48/648]
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Progr
am name
tcp 0 0 127.0.0.1:27017 0.0.0.0:* LISTEN 29160/mon
god
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1976/sshd
tcp6 0 0 :::22 :::* LISTEN 1976/sshd
udp 0 0 0.0.0.0:49948 0.0.0.0:* 1604/dhcl
ient
udp 0 0 0.0.0.0:68 0.0.0.0:* 1604/dhcl
ient
udp 0 0 10.240.241.116:123 0.0.0.0:* 2076/ntpd
udp 0 0 127.0.0.1:123 0.0.0.0:* 2076/ntpd
udp 0 0 0.0.0.0:123 0.0.0.0:* 2076/ntpd
udp6 0 0 :::12151 :::* 1604/dhcl
ient
udp6 0 0 :::123 :::* 2076/ntpd
Active UNIX domain sockets (only servers)
Proto RefCnt Flags Type State I-Node PID/Program name Path
unix 2 [ ACC ] STREAM LISTENING 405680 22814/ssh-agent /tmp/ssh-K
dkxJfFLpKTC/agent.22813
unix 2 [ ACC ] STREAM LISTENING 408230 24049/ssh-agent /tmp/ssh-o
fUeNNEwAqtP/agent.22243
unix 2 [ ACC ] STREAM LISTENING 416227 29160/mongod /tmp/mongo
db-27017.sock
unix 2 [ ACC ] SEQPACKET LISTENING 3692 284/udevd /run/udev/
control
unix 2 [ ACC ] STREAM LISTENING 5318 1798/acpid /var/run/a
cpid.socket
unix 2 [ ACC ] STREAM LISTENING 16170 5177/tmux /tmp//tmux
-1000/default
unix 2 [ ACC ] STREAM LISTENING 414450 28213/dbus-daemon /var/run/d
bus/system_bus_socket
unix 2 [ ACC ] STREAM LISTENING 404225 22324/1 /tmp/ssh-9
TlDmu4bjl/agent.22324
我有一个设置,我可以从我的本地机器 ssh 到我的远程服务器(即 Google Compute 实例)。我曾经能够从远程实例上的存储库中克隆、推送和拉取,而无需向远程实例添加任何密钥,也无需在线向我的存储库添加任何新密钥(仅来自本地计算机的公钥)。我相信远程实例正在使用我本地机器上的密钥来验证我的 Git 推送和拉取。
但是,当我在本地计算机上重新安装操作系统时,系统崩溃了。现在,当我尝试从远程实例连接 Github 服务器时,我得到以下信息:
无法克隆:
[lucas@ecoinstance]~/node$ git clone [email protected]:lucasExample/test.git test
Cloning into 'test'...
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
无法推送:
[lucas@ecoinstance]~/node/nodetest1$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
nothing to commit (working directory clean)
[lucas@ecoinstance]~/node/nodetest1$ git push
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
附加信息:
[lucas@ecoinstance]~/node/nodetest1$ ssh-add -l
Could not open a connection to your authentication agent.
[lucas@ecoinstance]~/.ssh$ ls
authorized_keys known_hosts
如您所见,我的远程实例上没有密钥。我从来没有在遥控器上有过钥匙,在我重新安装本地操作系统之前,它会很好地推拉。
我仍然可以在我的本地机器上克隆、推送和拉取,只是我的远程机器无法获得身份验证。我的本地操作系统是 Ubuntu 14.04,我的远程操作系统是 Debian Wheezy。
任何建议都会很棒。我不知道如何搜索这个概念,我可以通过我的本地机器从远程实例进行身份验证,因此也欢迎任何参考。
该styles.css
文件未加载到我的网页上,并且我托管在 Amazon S3 上。看来我的styles.css
文件被识别为text/x-asm
而不是text/css
我的index.html
文件中所述:
<link title="styles" href="styles.css" type="text/css" rel="stylesheet" />
如果我无权访问服务器,如何更正 MIME 类型?有解决办法吗?如果有不清楚的地方,请告诉我。这是使用 FireBug 的输出: