您的位置:首页 > 运维架构 > Linux

Centos帮助手册【不断更新中】

2016-01-09 16:17 495 查看

添加用户

[1]Add an User "cent" as an example below.
[root@dlp ~]# useradd cent

[root@dlp ~]# passwd cent

Changing password for user cent.
New UNIX password: # set password

Retype new UNIX password: # confirm

passwd: all authentication tokens updated successfully.
[root@dlp ~]# exit
# logout
[2]Try to switch to a user that was added above.
dlp login: cent
# input user name

password: # password

[cent@dlp ~]$ su -
# switch to root

Password: # root password

[root@dlp ~]# # just switched to root
[3]Make a user be only a user who can switch to root as an administration user. (it's 'cent' in this example)
[root@dlp ~]# usermod -G wheel cent

[root@dlp ~]# vi /etc/pam.d/su
#%PAM-1.0
auth            sufficient      pam_rootok.so
# Uncomment the following line to implicitly trust users in the "wheel" group.
#auth           sufficient      pam_wheel.so trust use_uid
# Uncomment the following line to require a user to be in the "wheel" group.
# uncomment the following line
auth            required        pam_wheel.so use_uid
auth            substack        system-auth
auth            include         postlogin
account         sufficient      pam_succeed_if.so uid = 0 use_uid quiet
account         include         system-auth
password        include         system-auth
session         include         system-auth
session         include         postlogin
session         optional        pam_xauth.so
[4]To forward to emails for root user to another user, set like follows. (it's 'cent' in this example)
[root@dlp ~]# vi /etc/aliases
# Person who should get root's mail # last line: uncomment and change to a user

root: cent
[root@dlp ~]# newaliases
# reload

防火墙和selinux

[1]If the Firewall on the server is unnecessarry (for example, because some firewalls are allready running in your LAN ), then stop it like follows. If needs, refer to here to configure Firewalld.
[root@dlp ~]# systemctl stop firewalld

[root@dlp ~]# systemctl disable firewalld

rm '/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service'
rm '/etc/systemd/system/basic.target.wants/firewalld.service'
SELinux
[2]If you'd like to disable SELinux (Security-Enhanced Linux), configure like follows.
[root@dlp ~]# vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX= disabled
# change
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted
[root@dlp ~]# reboot
# reboot

查看进程id

pgrep java



查看进程使用的环境变量



格式化显示:

cat /proc/25401/environ | tr '\0' '\n'



查看当前使用的shell类型

echo $SHELL

或者

echo $0



查看当前用户是否是root用户



root用户的uid是0
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: