Chinaunix首页 | 论坛 | 博客
  • 博客访问: 238022
  • 博文数量: 38
  • 博客积分: 517
  • 博客等级: 下士
  • 技术积分: 419
  • 用 户 组: 普通用户
  • 注册时间: 2011-05-07 09:05
文章分类

全部博文(38)

文章存档

2018年(1)

2015年(1)

2014年(4)

2013年(11)

2012年(4)

2011年(17)

分类: LINUX

2013-08-19 23:13:17

附加组
usermod -G yw,kf wg
-G 添加附加组,yw,kf 是组名 wg 用户
usermod -a -G yw wg
不加-a yw会覆盖原先的附加组 -a append
 
sg 切换附加组

用户的手动管理
修改配置文件
多用户导入
1、一个文件。写上用户的信息。和passwd的格式一样
newusers 
2、设置密码。只用写两列就可以。用户名:密码(明文)
chpasswd 

关于用户添加默认配置文件
/etc/default/useradd

环境配置文件
env     查看环境变量
set     查看所有变量
unset   
export a 把a设置为环境变量


ls -a /home/test

.bash_history     存放用户执行过得历史命令,当用户退出是记录
.bash_logout       当用户退出时执行的命令
.bashrc   保存用户自己的习惯性配置(如别名,让其永久有效)
.bash_profile 保存用户命令搜索路径

.bashrc  和  .bash_profile  区别
.bash_profile  登录级别的环境配置文件
.bashrc          shell级别的环境配置文件


全局环境配置文件
/etc/bashrc    全局的bashrc环境配置文件
/etc/profile   全局的profile环境配置文件
顺序:环境配置文件加载顺序
/etc/profile
.bash_profile
.bashrc
/etc/bashrc


su 和 su - 区别
su -  登录级别的切换(加载所有的环境配置文件)
su 切换用户 shell级别切换(只加载shell级别环境配置文件)


权限(基本权限和高级权限)
ll install.log
-rw-r--r-- 1 robin upup 39572 07-17 12:29 install.log

rwx  |  rwx  |  rwx
user   group    other
robin  upup     其他人
u      g        o
uid 0------robin-------upup--------other

对于文件:
r--------read cat head tail less more
w--------write  vim gedit  > >>
 x--------exec  ./  绝对路径
对于目录:
r--------read ls     r-x详细信息 
w--------write  touch rm mkdir   -wx
x--------cd 
 
test    rwxrwx-wx root root
aa.txt  rwxrwxrwx   root  root
test/ rwxrwx--- root root
tt/   rwxrwxrwx root root
tt.txt rwxrwxrwx root root     

chmod u+r file/dir
chmod u+r,g-r file/dir
chmod ug+rw  file/dir
chmod ugo-rwx file/dir
chmod a-rwx file/dir

chmod u=r file/dir
chmod u=rx,g=rw file/dir
chmod ug=rwx file/dir
chmod ugo=rwx file/dir
chmod a=rwx file/dir


目录权限-----记清楚
/   755
/etc 755
/var 755
/home 755
/root 750
/home/robin 700
/etc/shadow 400
/etc/passwd 644
/tmp 1777
root创建的目录 755
root创建的文件 644
普通用户创建目录 775
普通用户创建文件 664

修改拥有者和所属组
chown robin aa.txt
chgrp up aa.txt 
chown .uplooking aa.txt
chown root.up aa.txt
chown -R robin.uplooking test/

阅读(1518) | 评论(0) | 转发(2) |
给主人留下些什么吧!~~