用户和组+权限+文件夹属性+打包和压缩
2018-04-01 09:07
148 查看
添加一个tom用户,设置它属于users组,并添加注释信息
分步完成:useradd tom
usermod -g users tom
usermod -c "hr tom" tom
一步完成:useradd -g users -c "hr tom" tom
设置tom用户的密码
passwd tom
修改tom用户的登陆名为tomcat
usermod -l tomcat tom
将tomcat添加到sys和root组中
usermod -G sys,root tomcat
查看tomcat的组信息
groups tomcat
添加一个jerry用户并设置密码
useradd jerry
passwd jerry
添加一个交america的组
groupadd america
将jerry添加到america组中
usermod -g america jerry
将tomcat用户从root组和sys组删除
gpasswd -d tomcat root
gpasswd -d tomcat sys
将america组名修改为am
groupmod -n am america
==============================================================
创建a.txt和b.txt文件,将他们设为其拥有者和所在组可写入,但其他以外的人则不可写入:
chmod ug+w,o-w a.txt b.txt
创建c.txt文件所有人都可以写和执行
chmod a=wx c.txt 或chmod 666 c.txt
将/itcast目录下的所有文件与子目录皆设为任何人可读取
chmod -R a+r /itcast
将/itcast目录下的所有文件与子目录的拥有者设为root,用户拥有组为users
chown -R root:users /itcast
将当前目录下的所有文件与子目录的用户皆设为itcast,组设为users
chown -R itcast:users *
=================================================================
1.查看文件夹属性
ls -ld test
2.文件夹的rwx
--x:可以cd进去
r-x:可以cd进去并ls
-wx:可以cd进去并touch,rm自己的文件,并且可以vi其他用户的文件
-wt:可以cd进去并touch,rm自己的文件
ls -ld /tmp
drwxrwxrwt的权限值是1777(sticky)
=============================================================
1.gzip压缩
gzip a.txt
2.解压
gunzip a.txt.gz
gzip -d a.txt.gz
3.bzip2压缩
bzip2 a
4.解压
bunzip2 a.bz2
bzip2 -d a.bz2
5.将当前目录的文件打包
tar -cvf bak.tar .
将/etc/password追加文件到bak.tar中(r)
tar -rvf bak.tar /etc/password
6.解压
tar -xvf bak.tar
7.打包并压缩gzip
tar -zcvf a.tar.gz
8.解压缩
tar -zxvf a.tar.gz
解压到/usr/下
tar -zxvf a.tar.gz -C /usr
9.查看压缩包内容
tar -ztvf a.tar.gz
zip/unzip
10.打包并压缩成bz2
tar -jcvf a.tar.bz2
11.解压bz2
tar -jxvf a.tar.bz2
分步完成:useradd tom
usermod -g users tom
usermod -c "hr tom" tom
一步完成:useradd -g users -c "hr tom" tom
设置tom用户的密码
passwd tom
修改tom用户的登陆名为tomcat
usermod -l tomcat tom
将tomcat添加到sys和root组中
usermod -G sys,root tomcat
查看tomcat的组信息
groups tomcat
添加一个jerry用户并设置密码
useradd jerry
passwd jerry
添加一个交america的组
groupadd america
将jerry添加到america组中
usermod -g america jerry
将tomcat用户从root组和sys组删除
gpasswd -d tomcat root
gpasswd -d tomcat sys
将america组名修改为am
groupmod -n am america
==============================================================
创建a.txt和b.txt文件,将他们设为其拥有者和所在组可写入,但其他以外的人则不可写入:
chmod ug+w,o-w a.txt b.txt
创建c.txt文件所有人都可以写和执行
chmod a=wx c.txt 或chmod 666 c.txt
将/itcast目录下的所有文件与子目录皆设为任何人可读取
chmod -R a+r /itcast
将/itcast目录下的所有文件与子目录的拥有者设为root,用户拥有组为users
chown -R root:users /itcast
将当前目录下的所有文件与子目录的用户皆设为itcast,组设为users
chown -R itcast:users *
=================================================================
1.查看文件夹属性
ls -ld test
2.文件夹的rwx
--x:可以cd进去
r-x:可以cd进去并ls
-wx:可以cd进去并touch,rm自己的文件,并且可以vi其他用户的文件
-wt:可以cd进去并touch,rm自己的文件
ls -ld /tmp
drwxrwxrwt的权限值是1777(sticky)
=============================================================
1.gzip压缩
gzip a.txt
2.解压
gunzip a.txt.gz
gzip -d a.txt.gz
3.bzip2压缩
bzip2 a
4.解压
bunzip2 a.bz2
bzip2 -d a.bz2
5.将当前目录的文件打包
tar -cvf bak.tar .
将/etc/password追加文件到bak.tar中(r)
tar -rvf bak.tar /etc/password
6.解压
tar -xvf bak.tar
7.打包并压缩gzip
tar -zcvf a.tar.gz
8.解压缩
tar -zxvf a.tar.gz
解压到/usr/下
tar -zxvf a.tar.gz -C /usr
9.查看压缩包内容
tar -ztvf a.tar.gz
zip/unzip
10.打包并压缩成bz2
tar -jcvf a.tar.bz2
11.解压bz2
tar -jxvf a.tar.bz2
相关文章推荐
- 【CentOS】CentOS 给予普通用户对文件夹目录的所有权限
- AD域内普通域用户在客户端对program files文件夹没写入权限的解决方法
- Hbase 安装--2. 赋予hbase用户文件夹操作权限
- 文件属性和用户权限问题
- MAC将根目录文件夹的权限赋给用户
- 如何让文件夹对没有访问权限的用户自动隐藏
- Linux 给用户 赋某个文件夹操作的权限
- linux centos6.8查看用户所属组,给用户某个文件夹权限
- [加入用户]解决useradd 用户后没有加入用户Home文件夹的情况,Linux改变文件或文件夹的訪问权限命令,linux改动用户password,usermod的ysuum安装包。飞
- 在Windows Server 系统中根据用户对文件夹设置访问权限设置的方法
- day05 创建用户过程、文件夹,文件等权限修改等
- java.util.zip压缩打包文件总结一:压缩文件及文件下面的文件夹
- Linux下 文件夹 压缩 解压缩 打包
- 15 Linux更改权限解决新建用户不能读写创建文件/文件夹的问题
- 文件属性和用户权限
- java 将指定文件夹递归的进行zip打包压缩
- [Android]如何在编译阶段设置文件夹文件的权限属性(mode ,group, owner)
- windows服务器因多用户登陆文件夹权限更改后不能正常删除
- php apache用户写文件夹权限设置
- 要将 ASP.NET 访问权限授予某个文件,请在资源管理器中右击该文件,选择“属性”,然后选择“安全”选项卡。单击“添加”添加适当的用户或组。突出显示 ASP.NET 帐户,选中所需访问权限对应的框。