LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
楼主: dragonnapalm

如何打开或者关闭端口?

[复制链接]
发表于 2003-3-3 17:16:11 | 显示全部楼层
平时上网是因为别人提供了HTTP服务,开放了80端口,不是因为你自己开了80端口。????那当你扫别人端口时,你就会发现,包括98,它的80端口是开着的,你可以试试是不是??到linux来我才会有这疑问,,难道98默认装有iis或是web服务的软件吗?---没有~
发表于 2003-3-3 22:06:23 | 显示全部楼层

这些端口可以关掉的吗???

请问

111/tcp    open        sunrpc
1024/tcp   open        kdm
6000/tcp   open        X11

这三个端口是干什么用的,可以关掉 吗???如何关呢?

它们相应的服务是什么??
发表于 2003-3-3 22:51:25 | 显示全部楼层
上边两个,好象都是因为开启了某个服务才打开的,cloud忘了具体是哪个了。
sunrpc好象是netfs打开的,不过可能错了。你用这个命令
netstat -nap | grep  sunrpc
就可以看到是哪个进程开启它的了
然后把相应的服务关闭,应该就可以了。

至于6000端口的监听,你需要在X启动脚本那里加一个 -nolisten tcp这个参数,它就不会继续监听了。
/etc/X11/gdm/gdm.conf
这个文件里,有这么一行
command=/usr/X11R6/bin/X
把它变成
command=/usr/X11R6/bin/X -nolisten tcp


以上
siyeclover
发表于 2003-3-3 23:09:18 | 显示全部楼层
98机器都默认开80端口???
不会吧?
你给cloud一个98机器的IP,cloud扫扫,看是否真的开80端口了。

以上
siyeclover
发表于 2003-3-4 12:49:30 | 显示全部楼层
61.145.108.1-61.144.255.255

你自己看看,~相信你曾经也装过98,你自己装好后,浏览器开出来

打开一个网址,扫自己的端口看看~
发表于 2003-3-4 12:53:05 | 显示全部楼层
装好系统默认开6000端口,是什么服务来的?关掉有什么影响没有?
发表于 2003-3-4 17:03:54 | 显示全部楼层
你说的"打开",事实上是指"是否有服务程序在监听该端口". 象98/xp之类的OS,缺省是没有什么服务程序运行的,所以是"关闭"的. Linux就不一样了,可以运行几乎所有的网络服务.

22 ---- ssh,别人可以通过SSH(SecureSHell)连接到你的机器
111 --- sunrpc(Sun Remote Procedure Call),Sun公司开发的网络服务程序,作为NIS(Network Information Service)的支持程序
1024 --- kdm, 我不太清楚,不过从名字看来象是提供KDE远程登陆的端口(请高人指正!).
6000 --- X服务器

上述就是你机器上所运行的服务程序. 因为你没运行HTTP服务,所以80口是"关闭"的,但这并不妨碍你流览网页,因为此时你是作为"客户"使用对方提供的HTTP服务,对方的80(或8080)端口一定是"打开"的.

还是自己啃啃相关书籍吧,那样你就会对 服务器/客户 这种工作模式有更好的认识,你的问题也就迎刃而解了.
发表于 2003-3-4 17:13:20 | 显示全部楼层
X监听6000端口,别人可以在他们的机器上运行X程序(如xclock),而把显示通过网络输出到你的显示器上;或者,你用SSH连接到别人的机器上,运行X程序,把显示放到你的显示器上.

如果网络安全对你来说并不太重要,而且你有几台LINUX机器,那么这个功能很有用.
发表于 2003-3-4 21:46:08 | 显示全部楼层
恩,谢谢你~
发表于 2003-3-5 16:41:07 | 显示全部楼层
# GDM Configuration file.  You can use gdmsetup program to graphically
# edit this, or you can optionally just edit this file by hand.  Note that
# gdmsetup does not tweak every option here, just the ones most users
# would care about.  Rest is for special setups and distro specific
# tweaks.  If you edit this file, you should send the USR1 signal to the
# daemon so that it restarts: (Assuming you have not changed PidFile)
#   kill -USR1 `cat /var/run/gdm.pid`
# (USR1 will make gdm not kill existing sessions and will only restart gdm
# after all users log out. You can use HUP if you want an immediate restart.)
#
# Have fun! - George

[daemon]
AutomaticLoginEnable=false
AutomaticLogin=
# If you are having trouble with using a single server for a long time and
# want gdm to kill/restart the server, turn this on
AlwaysRestartServer=false
Configurator=/usr/sbin/gdmsetup --disable-sound --disable-crash-dialog
GnomeDefaultSession=/usr/share/gnome/default.session
Chooser=/usr/bin/gdmchooser
DefaultPath=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin
DisplayInitDir=/etc/X11/gdm/Init
Greeter=/usr/bin/gdmgreeter
#Uncomment this for the regular greeter
#Greeter=/usr/bin/gdmlogin --disable-sound --disable-crash-dialog
RemoteGreeter=/usr/bin/gdmlogin
Group=gdm
HaltCommand=/usr/bin/poweroff
KillInitClients=true
LogDir=/var/log/gdm
PidFile=/var/run/gdm.pid
PostSessionScriptDir=/etc/X11/gdm/PostSession/
PreSessionScriptDir=/etc/X11/gdm/PreSession/
# Distributions:  If you have some script that runs an X server in say
# VGA mode, allowing a login, could you please send it to me?
FailsafeXServer=
XKeepsCrashing=/etc/X11/gdm/XKeepsCrashing
RebootCommand=/sbin/shutdown -r now
RootPath=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin
ServAuthDir=/var/gdm
SessionDir=/etc/X11/gdm/Sessions/
SuspendCommand=
User=gdm
UserAuthDir=
UserAuthFBDir=/tmp
UserAuthFile=.Xauthority
TimedLoginEnable=false
TimedLogin=
TimedLoginDelay=30
StandardXServer=/usr/X11R6/bin/X
FlexibleXServers=5
Xnest=/usr/X11R6/bin/Xnest -name Xnest -kb

[security]
# If any distributions ship with this one off, they should be shot
# this is only local, so it's only for say kiosk use, when you
# want to minimize possibility of breakin
AllowRoot=true
# If you want to be paranoid, turn this one off
AllowRemoteRoot=true
AllowRemoteAutoLogin=false
RelaxPermissions=0
RetryDelay=1
UserMaxFile=65536
SessionMaxFile=524388

[xdmcp]
# Distributions: Ship with this off.  It is never a safe thing to leave
# out on the net.  Alternatively you can set up /etc/hosts.allow and
# /etc/hosts.deny to only allow say local access.
Enable=false
HonorIndirect=true
MaxPending=4
MaxPendingIndirect=4
MaxSessions=16
MaxWait=15
MaxWaitIndirect=15
DisplaysPerHost=1
Port=177
# Willing script, none is shipped and by default we'll send
# hostname system id
Willing=/etc/X11/gdm/Xwilling

[gui]
GtkRC=/usr/share/themes/Bluecurve/gtk-2.0/gtkrc
MaxIconWidth=128
MaxIconHeight=128

[greeter]
TitleBar=false
ConfigAvailable=false
Browser=false
DefaultFace=/usr/share/pixmaps/nobody.png
DefaultLocale=en_US
# These are things excluded from the face browser, not from logging in
Exclude=nfsnobody
MinimalUID=500
GlobalFaceDir=/usr/share/faces/
Icon=/usr/share/pixmaps/gdm.xpm
LocaleFile=/etc/X11/gdm/locale.alias
Logo=
## nice RH logo for the above line: /usr/share/pixmaps/redhat/shadowman-200.png
Quiver=true
SystemMenu=true
# Note to distributors, if you wish to have a different Welcome string
# and wish to have this translated you can have entries such as
# Welcome[cs]=Vitejte na %n
# Just make sure the string is in utf-8
Welcome=Welcome to %n
LockPosition=true
SetPosition=false
PositionX=0
PositionY=0
XineramaScreen=0
#Type can be 0=None, 1=Image, 2=Color
BackgroundType=0
BackgroundImage=
BackgroundScaleToFit=true
Backgroundcolor=#27408b
BackgroundRemoteOnlycolor=true
BackgroundProgram=/usr/bin/xsri --redhat-login --run
# if this is true then the background program is run always, otherwise
# it is only run when the BackgroundType is 0 (None)
RunBackgroundProgramAlways=false
ShowGnomeChooserSession=false
ShowGnomeFailsafeSession=false
ShowXtermFailsafeSession=false
Use24Clock=false
UseCirclesInEntry=false
# These two keys are for the new greeter.  Circles is the standard
# shipped theme
GraphicalTheme=happygnome
GraphicalThemeDir=/usr/share/gdm/themes/

[chooser]
DefaultHostImg=/usr/share/pixmaps/nohost.png
HostImageDir=/usr/share/hosts/
ScanTime=3
Hosts=
Broadcast=true

[debug]
# This will enable debugging into the syslog, usually not neccessary
# and it creates a LOT of spew of random stuff to the syslog
Enable=false

[servers]
0=Standard
#1=Standard
#Note: If you want to make sure X runs on a specific virtual console on linux,
#      you can use the following (for console 7).  However this can cause
#      problems for some users.  Be careful about this, getting this wrong
#      can lead to an unusable console.  Best solution is to make sure gdm
#      starts as the last thing, and that will make it not neccessary to
#      do hacks like this.
#0=Standard vt7
#
#Note: If you want to run an X terminal you could add an X server such as this
#0=Terminal -query serverhostname
# or for a chooser (optionally serverhostname could be localhost)
#0=Terminal -indirect serverhostname

[server-Standard]
name=Standard server
command=/usr/X11R6/bin/X
flexible=true

# To use this server type you should add -query host or -indirect host
# to the command line
[server-Terminal]
name=Terminal server
# Add -terminate to make things behave more nicely
command=/usr/X11R6/bin/X -terminate
# Make this not appear in the flexible servers (we need extra params
# anyway, and terminate would be bad for xdmcp)
flexible=false
# Not local, we do not handle the logins for this X server
handled=false
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表