[root@MSJTVL-MJSP-A01 sm01]# vim /etc/rc.d/rc.local #!/bin/sh # # This script will be executed *after* all the other init scripts. # You can put your own initialization stuff in here if you don't # want to do the full Sys V style init stuff. touch /v
1.在/etc/profile中添加如下代码: #history USER_IP=`>/dev/null| awk '{print $NF}'|sed -e 's/[()]//g'` HISTDIR=/usr/share/.history if [ -z $USER_IP ] then USER_IP=`hostname` fi if [ ! -d $HISTDIR ] then mkdir -p $HISTDIR $HISTDIR fi if [ ! -d $HISTDIR/${LOGNAME
功能说明:用root用户执行一个脚本,脚本里需要切换到普通用户DT去执行其他命令,其中就用到了EOF,用法如下: #!/bin/bash su - DT<<EOF cd apache-tomcat-7.0.54/bin sh startup.sh EOF 当时以为su - DT就跟在交换界面执行一样会把环境也切换过去,所以在分界符EOF里用的是相对路径,结果一运行就报错: -bash: line 8: cd: apache-tomcat-7.0.54/bin: 没有那个文件或目录 然后就做了个
默认情况下,访问网络端口需要root权限,而wireshark的只是/usr/share/dumpcap的一个UI,/usr/share/dumpcap需要root权限,所以没法non-root用户无法读取网卡列表. 解决办法很简单,sudo wireshark 但是wireshark官方不推荐这么做: Running as user "root" and group "root".This could be dangerous. If you're running