CentOS 7 -查看当前系统中的所有用户

24 篇文章 0 订阅

查看当前系统中的所有用户

$ cut --delimiter : --fields 1 /etc/passwd
root
bin
daemon
adm
lp
sync
shutdown
halt
mail
operator
games
ftp
nobody
systemd-network
dbus
polkitd
sshd
postfix
  • --delimiter : 使用 : 作为分隔符;
  • --fields 1 选择第 1 个域。

命令和部分选项的描述:

NAME
       cut - remove sections from each line of files
SYNOPSIS
       cut OPTION... [FILE]...
DESCRIPTION
       Print selected parts of lines from each FILE to standard output.
       Mandatory arguments to long options are mandatory for short options too.
       
       -b, --bytes=LIST
              select only these bytes
       -c, --characters=LIST
              select only these characters
       -d, --delimiter=DELIM
              use DELIM instead of TAB for field delimiter
       -f, --fields=LIST
              select only these fields;  also print any line that contains no delimiter character, unless the -s option is specified
       -n     with -b: don't split multibyte characters
       --complement
              complement the set of selected bytes, characters or fields
       -s, --only-delimited
              do not print lines not containing delimiters
       --output-delimiter=STRING
              use STRING as the output delimiter the default is to use the input delimiter
       --help display this help and exit
       --version
              output version information and exit

       Use  one,  and only one of -b, -c or -f.  Each LIST is made up of one range, or many ranges separated by commas.  Selected input is written in the same order that it is read, and is written exactly once.  Each range is one of:

       N      N'th byte, character or field, counted from 1
       N-     from N'th byte, character or field, to end of line
       N-M    from N'th to M'th (included) byte, character or field
       -M     from first to M'th (included) byte, character or field

       With no FILE, or when FILE is -, read standard input.
       GNU coreutils online help: <http://www.gnu.org/software/coreutils/> Report cut translation bugs to <http://translationproject.org/team/>

用户的基本信息(拓展)

/etc/passwd 文件是描述系统用户登录帐户的文本文件:

$ cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin
games:x:12:100:games:/usr/games:/sbin/nologin
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
nobody:x:99:99:Nobody:/:/sbin/nologin
systemd-network:x:192:192:systemd Network Management:/:/sbin/nologin
dbus:x:81:81:System message bus:/:/sbin/nologin
polkitd:x:999:998:User for polkitd:/:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
postfix:x:89:89::/var/spool/postfix:/sbin/nologin
mk:x:1000:1000:mk:/home/mk:/bin/bash

其中,每列对应一个用户信息,其格式为 name:password:UID:GID:GECOS:directory:shell,具体含义可以通过执行 man 5 passwd 命令查看。

如果在使用 man 5 passwd 命令时,提示 No manual entry for passwd in section 5,则需执行 yum install --assumeyes man-pages 命令安装 man-pages

  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
CentOS 6.5 Sendmail邮件服务器配置实例 【例题】 在服务器上配置sendmail服务器。发送服务器是smtp.test.com,接收邮件服务器为pop 3.test.com。创建两个邮件账户mail1和mail2,密码均为admin12345。配置完毕后在ou tlook上两个账户能够相互收发邮件。服务器IP:192.168.1.168。 【配置】 1. 安装dns服务为域名解析: yum install bind –y # yum 安装dns服务 2. 在DNS服务器上添加以下正向解析和反向解析: 正向解析: mail A 192.168.1.168 #mail域名解析 @ MX 5 mail #邮件交换记录 pop3 CNAME mail #添加别名解析 # smtp CNAME mail 反向解析: 168 PTR mail.test.com. #添加PTR指针,域名后面不要忘记加小数点 168 PTR pop3.test.com. 168 PTR smtp.test.com. 3. 安装sendmail服务 (提供发送服务smtp 工作端口:25): yum install sendmail –y #一般centos6.5默认是已经安装了postfix服务器并已经启动了的。 4. 安装dovecot服务 (提供接收服务 pop3 工作端口:110): yum install dovecot –y #安装dovecot服务 提供接收服务。 5. 配置sendmail服务的主配置文件 /etc/mail/sendmail.mc修改下面字段: myhostname = sample.test.com #置系统的主机名 mydomain = test.com #设置域名(此处设置将成为E- mail地址"@"后面的部分) myorigin = $mydomain  #设置发信地址 inet_interfaces = all  #监听所有地址 (一定要把inet_interfaces = localhost给注释掉) mydestination = $myhostname, $mydomain #指定发给本地邮件的域名 relay_domains = $mydestination #设置可以转发那些域的邮件 6. 配置dove cot服务器的主配置文件 /etc/dovecot/dovecot.conf 修改下面字段: protocols = imap pop3 lmtp #把这一行的注释去掉(约在20行 开启pop3认证方式) 7. 配置dovecot服务器配置文件 /etc/dovecot/conf.d/10-mail.conf 修改下面字段: mail_localtion = mbox:~/mail:INBOX=/val/mail/%u #把这一行的注释去掉(约在25行 指定账户邮箱目录) 8. 配置dovecot服务器配置文件 /etc/dovecot/conf.d/10-auth.conf 修改下面字段: disable_plaintext_auth = no #把这一行注释去掉yes改为no (约在9行 开启认证) 9. 创建邮件账户(邮件账户就是Linux系统系统用户: useradd mail1 #创建mail1用户 useradd mail2 #创建mail2用户 passwd mail1 #设置mail1用户的密码(根据提示输入两遍) passwd mail2 #设置mail2用户的密码(根据提示输入两遍) 10、设置邮件账户目录的权限: chmod –R 777 /var #设置var目录的权限为777 -R是递归 11、启动服务: service postfix restart #重启postfix服务器 service dovecot start #启动dovecot服务器 【测试】 DNS地址设置为服务器的IP使用outlook等邮箱工具,进行登录测试,互相能收发邮件即 可。 【小结】 1. 查找pop3服务器成功但提示pop3登录失败,可能是/var目录下的邮件账户目录权限不够 。 2. 提示找不到smtp 和pop3服务器可能是dns解析有问题。 3. 查找smtp服务器成功但提示发送测试邮件失败,检查一下监听地址字段是否是监听所有 ,监听本地的字段项是否已经注释。 ----------------------- CentOS-6全文共3页,当前为第1页。 CentOS-6全文共3页,当前为第2页。 CentOS-6全文共3页,当前为第3页。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值