Fonctionnalités du shell Login / Nologin

vim / etc / passwd

shell de connexion: su - wesley

coquille de nologin: su wesley

Ajout de la barre centrale commutée au shell précédent, appelé shell de connexion, pas de barre centrale commutée au shell précédent, appelé shell nologin, et il n'y a pas d'environnement utilisateur pour charger de nouveaux utilisateurs.

[root@localhost ~]# rpm -qc bash
/etc/skel/.bash_logout
/etc/skel/.bash_profile
/etc/skel/.bashrc
[root@localhost ~]# usradd wesley
-bash: usradd: command not found
[root@localhost ~]# useradd wesley
[root@localhost ~]# usermod -s /bin/bash wesley
usermod: no changes
[root@localhost ~]# su wesley
[wesley@localhost root]$ ls  # 当前目录还是homt/root,普通用户无权访问root目录
ls: cannot open directory .: Permission denied
[wesley@localhost root]$ exit
exit
[root@localhost ~]# su - wesley # 加-,会跟着用户名一起切换到普通用户的home目录
Last login: Thu Apr  9 18:23:08 EDT 2020 on pts/0
[wesley@localhost ~]$ pwd
/home/wesley
[wesley@localhost ~]$ exit
logout
[root@local

Aucun plan utilisateur n'est ajouté après su, passer à root par défaut

[root@localhost ~]# ll /etc/profile
-rw-r--r--. 1 root root 1983 Oct 27 08:25 /etc/profile
[root@localhost ~]# ll /etc/bashrc
-rw-r--r--. 1 root root 2853 Oct 30  2018 /etc/bashrc
[root@localhost ~]#
[root@localhost ~]# ll .bash_profile
-rw-r--r--. 1 root root 302 Nov  9 11:15 .bash_profile
[root@localhost ~]# ll .bashrc
-rw-r--r--. 1 root root 176 Dec 28  2013 .bashrc

Les fichiers rouges / bleus sont exécutés lors de l'entrée dans le shell. Fichier jaune, exécuté lors de la sortie du shell

Le shell de connexion (plus la barre) exécute quatre fichiers et le shell sans connexion (sans barre d'ajout) n'exécute que 2 fichiers.

Tant que bash-complétement est installé dans bash, il y aura une fonction de complétion automatique

[root@localhost ~]# rpm -qa |grep bash-com
bash-completion-2.1-6.el7.noarch
[root@localhost ~]# date
Thu Apr  9 18:58:53 EDT 2020
[root@localhost ~]# !!
date
Thu Apr  9 18:58:54 EDT 2020
[root@localhost ~]# !$
date
Thu Apr  9 18:58:58 EDT 2020
[root@localhost ~]# !10
ls
anaconda-ks.cfg  c  paramiko  test
[root@localhost ~]#
[root@localhost ~]# alias   查看别名
alias cp='cp -i'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias mv='mv -i'
alias rm='rm -i'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
[root@localhost ~]# unalias
unalias: usage: unalias [-a] name [name ...]
[root@localhost ~]# yum install -y sl
[root@localhost ~]# alias yang='sl'
[root@localhost ~]# yang    # 查看小火车程序

Publié 385 articles originaux · gagné 130 · 110 000 vues

Je suppose que tu aimes

Origine blog.csdn.net/f2157120/article/details/105425049
conseillé
Classement