win7etc文件夹夹是什么意思

/etc/bashrc,用户目录下.bashrc有什么区别? - johnny_HITWH - 推酷
/etc/bashrc,用户目录下.bashrc有什么区别? - johnny_HITWH
/etc/bashrc,用户目录下.bashrc有什么区别?&
一个是针对整个系统所有用户的,一个是针对特定用户的./etc/bashrc修改了以后要重启系统才生效,而用户目录下.bashrc修改了以后重新登录就生效&
2。/etc/profile与/etc/bashrc的区别?&
前一个主要用来设置一些系统变量,比如JAVA_HOME等等,后面一个主要用来保存一些bash的设置.&&
/etc/profile:此文件为系统的每个用户设置环境信息,当用户第一次登录时,该文件被执行.
并从/etc/profile.d目录的配置文件中搜集shell的设置.&
/etc/bashrc:为每一个运行bash shell的用户执行此文件.当bash shell被打开时,该文件被读取.&
~/.bash_profile:每个用户都可使用该文件输入专用于自己使用的shell信息,当用户登录时,该&
文件仅仅执行一次!默认情况下,他设置一些环境变量,执行用户的.bashrc文件.&
~/.bashrc:该文件包含专用于你的bash shell的bash信息,当登录时以及每次打开新的shell时,该&
该文件被读取.&
~/.bash_logout:当每次退出系统(退出bash shell)时,执行该文件.&
另外,/etc/profile中设定的变量(全局)的可以作用于任何用户,而~/.bashrc等中设定的变量(局部)只能继承/etc/profile中的变量,他们是&父子&关系.&
~/.bash_profile 是交互式、login 方式进入 bash 运行的&
~/.bashrc 是交互式 non-login 方式进入 bash 运行的&
通常二者设置大致相同,所以通常前者会调用后者。&
.bash_profile 文件在通过控制台(或远程登录, 比如ssh)登录(login)系统的时候被执行的shell脚本.&
而 .bashrc 则是在打开虚拟终端的时候才会起作用,比如在GNOME,KDE中执行rxvt.
(1)在 Linux 管理中,常有需要修改根目录下 .bash_profile 文件,更改环境变量的情况,文件修改后,一般的做法是重新登录,或者重新启动机器,不知道大家是怎么做的,反正我以前是用前面的两个办法中的一个,感觉很不方便。现在发现了一个命令: source,在修改好 .bash_profile 文件后,直接运行这个命令如:
&&& #soure .bash_profile
&&& 就可以直接让环境变量的修改生效了。
(2)另外据发现 &.& 也可以使配置好的环境变量生效,同上的等效命令为:
&&& #. .bash_profile 网管联盟bitsCN@com
&&& 据笔者认为,“.” 命令应该是soure命令的缩写,欢迎大家发表对本文章的看法。
(3)退出当前用户,重新进入,也可以使环境变量生效
/etc/profile:
此文件为系统的每个用户设置环境信息,当用户第一次登录时,该文件被执行.并从/etc/profile.d目录的配置文件中搜集shell的设置.
英文描述为:
# /etc/profile
# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc
# It's NOT a good idea to change this file unless you know what you
# are doing. It's much better to create a custom.sh shell script in
# /etc/profile.d/ to make custom changes to your environment, as this
# will prevent the need for merging in future updates.
所以如果你有对/etc/profile有修改的话必须得重启你的修改才会生效,此修改对每个用户都生效。
/etc/bashrc:
为每一个运行bash shell的用户执行此文件.当bash shell被打开时,该文件被读取.
英文描述为:
# /etc/bashrc
# System wide functions and aliases
# Environment stuff goes in /etc/profile
# It's NOT a good idea to change this file unless you know what you
# are doing. It's much better to create a custom.sh shell script in
# /etc/profile.d/ to make custom changes to your environment, as this
# will prevent the need for merging in future updates.
如果你想对所有的使用bash的用户修改某个配置并在以后打开的bash都生效的话可以修改这个文件,修改这个文件不用重启,重新打开一个bash即可生效。
~/.bash_profile:
每个用户都可使用该文件输入专用于自己使用的shell信息,当用户登录时,该文件仅仅执行一次!默认情况下,他设置一些环境变量,执行用户的
此文件类似于
/etc/profile
,也是需要需要重启才会生效,/etc/profile对所有用户生效,
~/.bash_profile
只对当前用户生效。
该文件包含专用于你的bash shell的bash信息,当登录时以及每次打开新的shell时,该文件被读取.(每个用户都有一个.bashrc文件,在用户目录下)
此文件类似于
/etc/bashrc
,不需要重启生效,重新打开一个bash即可生效,&&
/etc/bashrc
对所有用户新打开的bash都生效,但
只对当前用户新打开的bash生效。
~/.bash_logout:
当每次退出系统(退出bash shell)时,执行该文件.&
另外,/etc/profile中设定的变量(全局)的可以作用于任何用户,而~/
等中设定的变量(局部)只能继承/etc/profile中的变量,他们是&父子&关系.
~/.bash_profile 是交互式、login 方式进入bash 运行的;
&是交互式 non-login 方式进入bash 运行的;
通常二者设置大致相同,所以通常前者会调用后者。
已发表评论数()
请填写推刊名
描述不能大于100个字符!
权限设置: 公开
仅自己可见
正文不准确
标题不准确
排版有问题
主题不准确
没有分页内容
图片无法显示
视频无法显示
与原文不一致博客访问: 699549
博文数量: 405
博客积分: 3010
博客等级: 中校
技术积分: 4333
注册时间:
APP发帖 享双倍积分
IT168企业级官微
微信号:IT168qiye
系统架构师大会
微信号:SACC2013
分类: LINUX
/etc 是Linux下的配置文件的老家, 很多管理和使用的修改都在这里
3. 网络配置文件
3.1 /etc/hosts
#/etc/hosts
#文件格式: IPaddress hostname aliases
#文件功能: 提供主机名到IP地址的对应关系,建议将自己经常使用的主机
加入此文件中,也可将没有DNS记录的机器加入到此文件中,
这样会方便网络应用
localhost.localdomain
202.118.66.81
3.2 /etc/resolv.conf
文件功能:DNS客户机配置文件,设置DNS服务器的IP地址及DNS域名
相关文件:/etc/host.conf
文件格式:
domainname 域名
nameserver Primary_DNS_Server_IP_address
nameserver Second_DNS_Server_IP_address
其中domainname和search可同时存在,也可只有一个;nameserver可指定多个
示例文件内容:
nameserver 202.118.66.6
3.3 /etc/host.conf
功能:指定主机名查找方法,通常指先查找文件/etc/hosts,找不到时再向DNS服务器请求。
对于大多数用户不用改动此文件内容。
Linux: /etc/host.conf文件内容
order hosts, bind
Soalris: /etc/nsswitch.conf 中的hosts项
hosts files, dns
3.4 /etc/HOSTNAME ( Linux Redhat 5.x Distribution)
功能:设置主机名,不同LINUX之间可能有所差别,请使用
egrep hostname /etc/rc.d/init.d/*
egrep hostname /etc/init.d/*
查找相应版本上的主机名设置文件及方法。
Linux Redhat 5.x对应文件: /etc/sysconfig/network的HOSTNAME项。
3.5 /etc/inetd.conf
Internet 超级服务器, 相关程序: /usr/sbin/inetd
rsh rcp rlogin (建议最好关闭r服务)
其他服务最好关掉
# inetd.conf
This file describes the services that will be available
through the INETD TCP/IP super server.
To re-configure
the running INETD process, edit this file, then send the
INETD process a SIGHUP signal.
# Version:
@(#)/etc/inetd.conf
# Authors:
Original taken from BSD UNIX 4.3/TAHOE.
Fred N. van Kempen,
# Modified for Debian Linux by Ian A. Murdock
# Modified for RHS Linux by Marc Ewing
# Echo, discard, daytime, and chargen are used primarily for testing.
# To re-read this file after changes, just do a 'killall -HUP inetd'
# These are standard services.
/usr/sbin/tcpd
in.ftpd -l -a
/usr/sbin/tcpd
in.telnetd
/usr/sbin/tcpd
# do not uncomment smtp unless you *really* know what you are doing.
# smtp is handled by the sendmail daemon now, not smtpd.
It does NOT
# run from here, it is started at boot time from /etc/rc.d/rc#.d.
/usr/bin/smtpd
/usr/sbin/tcpd
# Shell, login, exec and talk are BSD protocols.
/usr/sbin/tcpd
/usr/sbin/tcpd
in.rlogind
/usr/sbin/tcpd
/usr/sbin/tcpd
/usr/sbin/tcpd
/usr/sbin/tcpd
# Pop and imap mail services et al
/usr/sbin/tcpd
/usr/sbin/tcpd
/usr/sbin/tcpd
# The Internet UUCP service.
/usr/sbin/tcpd
/usr/lib/uucp/uucico
# Tftp service is provided primarily for booting.
Most sites
# run this only on machines acting as "boot servers." Do not uncomment
# this unless you *need* it.
/usr/sbin/tcpd
#bootps dgram
/usr/sbin/tcpd
# Finger, systat and netstat give out user information which may be
# valuable to potential "system crackers."
Many sites choose to disable
# some or all of these services to improve security.
# cfinger is for GNU finger, which is currently not in use in RHS Linux
/usr/sbin/tcpd
in.fingerd
#cfinger stream tcp
/usr/sbin/tcpd
in.cfingerd
#systat stream
/usr/sbin/tcpd
/bin/ps -auwwx
/usr/sbin/tcpd
/bin/netstat
# Time service is used for clock syncronization.
/usr/sbin/tcpd
/usr/sbin/tcpd
# Authentication
/usr/sbin/in.identd in.identd -l -e -o
# End of inetd.conf
linuxconf stream tcp wait root /bin/linuxconf linuxconf --http
3.6 inetd.conf相关文件/etc/services(SYSV/BSD/LINUX相同)
基本不用编辑,linux自带的已包含大部分服务, Solaris 可能需要增加(POP3),
参考相应的服务器安装说明,在此文件中列出了所有可用的网络服务。
# services
This file describes the various services that are
available from the TCP/IP subsystem.
It should be
consulted instead of using the numbers in the ARPA
include files, or, worse, just guessing them.
# Version:
@(#)/etc/services
Fred N. van Kempen,
# 文件格式:服务名称
端口号/协议
# rfc-1078
ttytst source
ttytst source
# resource location
nameserver
# usually to sri-nic
# deprecated
# bootp server
# bootp client
# gopher server
# www is used by some broken
# progs, http is more correct
# Kerberos authentication--udp
# Kerberos authentication--tcp
# BSD supdupd(8)
# usually to sri-nic
# ISO Mail
# PostOffice V.2
# PostOffice V.3
# PostOffice V.3
portmapper
# RPC 4.0 portmapper UDP
portmapper
# RPC 4.0 portmapper TCP
# User Verification
# Network News Transfer
# Network Time Protocol
# Network Time Protocol
netbios-ns
netbios-ns
netbios-dgm
netbios-dgm
netbios-ssn
# imap network mail protocol
# Window System
# BSD rexecd(8)
# BSD rlogind(8)
# BSD rwhod(8)
# BSD rshd(8)
# BSD syslogd(8)
# BSD lpd(8)
# BSD talkd(8)
# SunOS talkd(8)
# for LucasFilm
router routed
# 521/udp too
timeserver
# experimental
conference
# -for emergency broadcasts
# BSD uucpd(8) UUCP service
# Kerberos authenticated rlogin
# and remote shell
# experimental
rfs_server rfs
# Brunhoff remote filesystem
# experimental
# experimental
# ECD Integrated PC board srvr
# NFS Mount Service
# PC-NFS DOS Authentication
# BW-NFS DOS Authentication
kerberos-adm
# Kerberos 5 admin/changepw
kerberos-adm
# Kerberos 5 admin/changepw
kerberos-sec
# Kerberos authentication--udp
kerberos-sec
# Kerberos authentication--tcp
kerberos_master 751/udp
# Kerberos authentication
kerberos_master 751/tcp
# Kerberos authentication
# Kerberos slave propagation
listener RFS remote_file_sharing
remote_login network_terminal
# Pop with Kerberos
ingreslock
# transputer net daemon
# GNU finger
# NFS File Service
# Kerberos encrypted rlogin
# Kerberos 5 to 4 ticket xlator
# Internet Relay Chat
# End of services.
# added by linuxconf RPM
3.7 /etc/hosts.allow /etc/hosts.deny (Linux下,或使用了tcpd, 参考inetd.conf)
/etc/hosts.allow 设置允许使用inetd服务的机器,如: All:202.118即允许所有来自
202.118.x.x的请求
/etc/hosts.deny 设置不允许使用inetd的机器
这两个文件的设定顺序请参考在线文档:
man hosts.allow
man hosts.deny
Internet 网络服务访问控制文件,
对于安全性要求较高的服务器建议采用xinetd替代inetd,
xinetd debian自带,其他的可以用源代码进行编译安装
3.8 /etc/networks
/etc/netmasks
列出路由所需要的网络地址,相关命令/usr/sbin/route,当然也可以不使用这两个
文件,在维护路由表时可直接使用IP地址及网络屏蔽位。
/etc/networks
202.199.128.0
/etc/netmasks
202.199.128.0 255.255.240.0
加入静态路由表项:
+---------------+
| Cisco 2511
+DLMU 202.118.64.0/255.255.255.0
+DLNA 210.47.192.0/255.255.240.0
+-------+-------+
| 202.118.66.254
202.118.66.16
+-------+-------+
+-------------+
+-----------+
Switch/HUB
+-------+网络中心
+-----+ LAN Router+
+-------+-------+
+-------------+
+------+----+
202.118.68.0/255.255.252.0
+--------------+
+--------------+ 202.118.66.81+ (测试机器)
+--------------+
| 202.118.66.1(Default Router)
+-------+-------+
+-------+-------+
|202.112.30.65/255.255.255.252
|202.112.30.66/255.255.255.252
Cernet/Internet
(1) 202.118.66.81(Helius)
202.118.66.18 (peony)
202.118.066.081
255.255.255.0
-------------------
202.118.066.0
在同一个ip网络段
IP Address
MAC(Media Access Address)
202.118.66.18
08:00:20:96:01:6A
202.118.66.81
00:80:C8:4C:6A:D0
202.118.66.1
00:60:5C:F3:FF:75
202.118.66.81 -> 202.118.66.18
以太网的数据包:
08:00:20:96:01:6A + 00:80:C8:4C:6A:D0
(2) 202.118.66.81 -> 202.112.0.36
不在同一个ip段, 通过间接传送(通过路由器).
[hbwork@linden hbwork]$ netstat -rn
Kernel IP routing table
Destination
MSS Window
irtt Iface
202.118.66.0
255.255.255.0
202.118.66.1
Default Router
(3) 加入静态路由
相关命令:/usr/sbin/route或 /sbin/route
linux下需要加入自己网络的路由表项
/sbin/route add -net 202.118.66.0 netmask 255.255.255.0 eth0
/sbin/route add -net 202.199.128.0 netmask 255.255.240.0 gw 202.118.66.254
/sbin/route add -net dlrin gw 202.118.66.254
/sbin/route add -net dlrin gw dlrin-gw
/sbin/route add default gw 202.118.66.1
9. /etc/passwd
用户口令文件
10. /etc/shadow
(如果有此文件,系统支持shadow机制)
$ls -l /etc/shadow
-rwx------
/etc/shadow
11. /etc/fstab
File System Table
MountPoint
Filesystem Type
加载选项 ... fsck标志
/mnt/floppy
sync,user,noauto,nosuid,nodev,unhide
/dev/cdrom
/mnt/cdrom
user,noauto,nosuid,nodev,ro
Solairs下对应文件:
/etc/vfstab
12. /etc/exports
NFS(Network File System) Server 输出文件系统表, 最好不使用NFS.
nfs相关进程:
Solaris: mountd , nfsiod
/etc/init.d/nfs.server
内核支持nfs, /proc/filesystem, 也可以通过加载modules实现,
13./etc/defaultrouter (Solaris 2.x)
内容为Default Router的ip地址,
在linux下:
Redhat 5.x: /etc/sysconfig/network
GATEWAY=202.118.66.1
GATEWAYDEV=eth0
Debian: /etc/init.d/network
#! /bin/sh
ifconfig lo 127.0.0.1
route add -net 127.0.0.0
IPADDR=202.118.66.88
NETMASK=255.255.255.0
NETWORK=202.118.66.0
BROADCAST=202.118.66.255
GATEWAY=202.118.66.1
ifconfig eth0 ${IPADDR} netmask ${NETMASK} broadcast ${BROADCAST}
route add -net ${NETWORK}
[ "${GATEWAY}" ] && route add default gw ${GATEWAY} metric 1
14. /etc/bashrc /etc/csh.cshrc /etc/profile
/etc/bashrc
BASH(Bourne Again Shell) RunTime Command
Shell Script 用的最多
系统用户默认的环境设置, PATH, umask, TERM Type
/etc/csh.cshrc CSH Runtime COmmand
15. /etc/ftpaccess
FTP访问控制文件, 文件位置可变 , 通过
#egrep ftp /etc/inetd.conf
/usr/sbin/tcpd
in.ftpd -l -a
ftp服务器守护进程文件名
#which in.ftpd
/usr/sbin/in.ftpd
/usr/sbin/in.ftpd |egrep ftpaccess
/etc/ftpaccess
相关配置在ftp服务器配置中讲述。
16. /etc/ftpusers
不允许ftp的用户列表,一般包括root, uucp, bin等
17. /etc/ftpconvions /etc/ftpgroups
FTP服务器配置文件
18. /etc/group
用户组文件
19. /etc/sendmail.cf (Linux)
Sendmail(EMAIL服务器)配置文件
/etc/sendmail.cw
本地主机名
主机名: gingko.
/etdc/aliases
邮件别名文件
/etc/aliases.db
邮件别名二进制数据文件, 用newaliases建立
/etc/sendmail.hf
sendmail 帮助文件,
$telnet mailserver 25
Trying 202.118.66.8...
Connected to gingko.
Escape character is '^]'.
220 gingko. ESMTP Sendmail 8.9.1/8.9.1; Tue, 2 Feb :20 +080
214-This is Sendmail version 8.9.1
214-Topics:
214-For more info use "HELP ".
214-To report bugs in the implementation send email to
214-For local information send email to Postmaster at your site.
214 End of HELP info
以上目录结构是Linux的目录结构, Solaris 2.x目录结构是:
/etc/mail/sendmail.cf
/etc/mail/sendmail.cw
/etc/mail/sendmail.hf
/etc/mail/aliases
/etc/mail/aliases.db
20. /etc/issue
系统进站提示信息(主控台用)
/etc/issue.net telnet时显示信息( strings in.telnetd |egrep issue)
用户进入系统后的提示信息
21. /etc/named.boot
DNS(BIND 4.9.x) 启动文件
示例文件:(Caching Only Server)
directory /etc/namedb
primary 0.0.127.in-addr.arpa
named.local
cache . root.cache
其中root.cache 文件可通过dig得到:
dig @ns.internic.net . ns > /etc/namedb/root.cache
named.local文件内容如下:
SOA localhost. root.localhost. (
localhost.
localhost.
/etc/named.conf
DNS(BIND 8.1.x) 启动文件
(在Redhat 5.2下可用/usr/doc/bind-8.1.2/named-bootconf.pl将bind 4.9.x
的named.boot文件转换为bind8的named.conf文件格式, 执行过程如下:
/usr/doc/bind-8.1.2/named-bootconf.pl /etc/named.boot > /etc/named.conf)
22. /etc/host.equiv
$HOME/.rhosts
R*(rlogin, rsh , rcp, rexec)服务信任主机
主机名(FQDN)
23. /etc/ld.so.conf (LINUX)
动态链接库文件目录列表, 相应命令ldconfig
$LD_LIBRARY_PATH Solaris 下相应的环境变量
用ldd 列出相应文件所使用的动态链接库
/etc/default[119]ldd /usr/ucb/ls
libc.so.1 =>
/usr/lib/libc.so.1
libdl.so.1 =>
/usr/lib/libdl.so.1
*修改过此文件之后请使用命令ldconfig重新生成目录列表及连接库文件列表。
24. /etc/pam.d/login ( Linux Redhat)
/lib/security/pam_securetty.so
/etc/securetty (Linux Redhat, Debian)
root可登录的终端设备列表, tty[1-8] 为主控台上的设备,
ttyp* (LINUX)远程登录终端(TELNET)设备
/etc/default/login (Solaris)
# If CONSOLE is set, root can only login on that device.
# Comment this line out to allow remote login by root.
CONSOLE=/dev/console
注释掉相应的记录即可允许超级用户root从远程主机telnet登录
/etc/login.defs Linux Debian 登录控制文件
25. Linux Loader /etc/lilo.conf
多重启动文件,
**** 修改完此文件后一定需要执行lilo,
**** 重新编译安装新的linux kernel修改此文件并执行lilo
26. /etc/syslog.conf
syslogd configuration file,
27. /etc/smb.conf
服务器配置文件,将linux的文件系统与Windows 9x/NT共享
28. /etc/nologin
系统在要关机时不希望用户登录进来,就产生此文件,此文件内容为显示给用户的有
关拒绝连接的信息,用户此时就不能进入系统。当系统重新启动时如果有此文件,则
机器启动后任何用户不能使用系统,此时可考虑从软盘或光盘引导删除此文件,然后
再重新启动系统。
29. /etc/security
设定那些终端可以让root登录,一般情况下设定为只有console上的用户可能用root.
注:Redhat下使用了PAM机制,相应的文件为/etc/securetty.
30. /etc/X11/*
XFree86配置文件。
31. /etc/shells
用户可以使用的shell列表,如果强行修改/etc/passwd文件,也可以使用不在列表中
的shell程序,但对于shell不在此列表中的用户将无法使用FTP连接本系统。
32. /etc/mtab
系统在启动时创建的信息文件,内容为已经mount的文件系统,此文件内容是动态更
新的,参考/proc/mounts。
阅读(3843) | 评论(0) | 转发(1) |
相关热门文章
给主人留下些什么吧!~~
请登录后评论。以上由提供
当前位置:
> 详细页面
Linux使用/etc/group文件管理用户的方法
时间: 17:33来源:作者:qipeng
评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
系统教程栏目
热门系统教程
在笔记本电脑早已普及到会议室的这个年代,商务人士拿笔记...
热门系统下载
最新系统教程
热门软件下载
Copyright&2011 系统之家(www.xitongzhijia.net) 版权所有 闽ICP备号-1
本站发布的系统与软件仅为个人学习测试使用,请在下载后24小时内删除,不得用于任何商业用途,否则后果自负,请支持购买微软正版软件!
如侵犯到您的权益,请及时通知我们,我们会及时处理。

我要回帖

更多关于 ssh端口 的文章

 

随机推荐