useradd: warning: the home directory already exists. Not copying any file from skel directory intoit
1.问题描述
笔者想要创建一个用户,并把该该用户的家目录指定到一个目录下,使用
sudo useradd -d /data/tyb -m tyb
提示,
useradd: warning: the home directory already exists.
Not copying any file from skel directory into it.
系统添加用户的标准步骤
1.编辑/etc/passwd与/etc/group
2.创建用户主目录
3.从/etc/skel拷贝文件与目录
4.让新用户获得其主目录与文件的拥有权限
5.给新用户一个密码
知道系统创建用户的流程后,我们就大致推测可能的原因是,当前用户对data/tyb文件夹没有权限
可使用下面的命令查看权限
ls -l /data/tyb
提示:
total 699020
drwxr-xr-x 2 bbb bbb 4096 6月 29 17:16 anaconda
drwxrwxr-x 24 bbb bbb 4096 6月 29 18:58 anaconda3
drwxrwxr-x 2 bbb bbb 4096 6月 28 15:35 Desktop
-rw-rw-r-- 1 bbb bbb 1598 6月 29 20:55 java_error_in_pycharm_27314.log
-rw-r--r-- 1 bbb bbb 58808 11月 5 20:28 'Linux安装MATLAB2016a - 佳星辰 - 博客园.html'
-rw-r--r-- 1 root root 9336 11月 16 22:02 matlab_crash_dump.21639-1
-rw-r--r-- 1 root root 9336 11月 16 16:24 matlab_crash_dump.7562-1
drwxrwxrwx 4 bbb bbb 4096 11月 16 15:30 matlabLinux
-rw-r--r-- 1 bbb bbb 236060463 6月 29 20:44 NVIDIA-Linux-x86_64-465.31.run
drwxrwxr-x 9 bbb bbb 4096 6月 28 15:30 pycharm-community-2020.3.1
-rw-r--r-- 1 bbb bbb 479576231 6月 28 15:24 pycharm-community-2020.3.1.tar.gz
drwxr-xr-x 4 bbb bbb 4096 6月 28 14:03 TYB
drwxr-xr-x 2 bbb bbb 4096 6月 29 19:23 下载
drwxr-xr-x 2 bbb bbb 4096 6月 29 19:23 公共的
drwxr-xr-x 2 bbb bbb 4096 6月 29 19:23 图片
drwxr-xr-x 2 bbb bbb 4096 6月 29 19:23 文档
-rw-r--r-- 1 bbb bbb 66 11月 4 19:39 新建文本文档.txt
drwxr-xr-x 2 bbb bbb 4096 6月 29 19:23 模板
drwxr-xr-x 2 bbb bbb 4096 6月 29 19:23 视频
drwxr-xr-x 2 bbb bbb 4096 6月 29 19:23 音乐
当前用户对tyb下的文件没有权限
知道原因,解决方法为:为当前用户赋对tyb文件夹的操作权限
sudo chown -R aaa /data/tyb
把当前用户aaa指定为tyb文件的所有者
赋权后,再次使用命令查看
total 699020
drwxr-xr-x 2 aaa bbb 4096 6月 29 17:16 anaconda
drwxrwxr-x 24 aaa bbb 4096 6月 29 18:58 anaconda3
drwxrwxr-x 2 aaa bbb 4096 6月 28 15:35 Desktop
-rw-rw-r-- 1 aaa bbb 1598 6月 29 20:55 java_error_in_pycharm_27314.log
-rw-r--r-- 1 aaa bbb 58808 11月 5 20:28 'Linux安装MATLAB2016a - 佳星辰 - 博客园.html'
-rw-r--r-- 1 aaa root 9336 11月 16 22:02 matlab_crash_dump.21639-1
-rw-r--r-- 1 aaa root 9336 11月 16 16:24 matlab_crash_dump.7562-1
drwxrwxrwx 4 aaa bbb 4096 11月 16 15:30 matlabLinux
-rw-r--r-- 1 aaa bbb 236060463 6月 29 20:44 NVIDIA-Linux-x86_64-465.31.run
drwxrwxr-x 9 aaa bbb 4096 6月 28 15:30 pycharm-community-2020.3.1
-rw-r--r-- 1 aaa bbb 479576231 6月 28 15:24 pycharm-community-2020.3.1.tar.gz
drwxr-xr-x 4 aaa bbb 4096 6月 28 14:03 TYB
drwxr-xr-x 2 aaa bbb 4096 6月 29 19:23 下载
drwxr-xr-x 2 aaa bbb 4096 6月 29 19:23 公共的
drwxr-xr-x 2 aaa bbb 4096 6月 29 19:23 图片
drwxr-xr-x 2 aaa bbb 4096 6月 29 19:23 文档
-rw-r--r-- 1 aaa bbb 66 11月 4 19:39 新建文本文档.txt
drwxr-xr-x 2 aaa bbb 4096 6月 29 19:23 模板
drwxr-xr-x 2 aaa bbb 4096 6月 29 19:23 视频
drwxr-xr-x 2 aaa bbb 4096 6月 29 19:23 音乐
发现当前用户aaa已经具有权限了
就可以继续进行之前的操作了
useradd: warning: the home directory already exists. Not copying any file from skel directory intoit相关推荐
- 解决这个警告⚠️:warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory...
⚠️ 在电脑上使用终端连接服务器的时候,经常会打印出如下警告: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such ...
- su: warning: cannot change directory to /home/mysql: No such file or directory
[root@dbserver ~]# su - mysql Last login: Thu Aug 31 17:20:03 CST 2017 on pts/1 su: warning: cannot ...
- WARNING: The directory ‘/home/zhex/.cache/pip/http‘ or its parent directory is not owned by the curr
WARNING: The directory '/home/zhex/.cache/pip/http' or its parent directory is not owned by the curr ...
- 文件及文件夹操作- File类、Directory 类、FileInfo 类、DirectoryInfo 类
命名空间:using system .IO; 1. File类: 创建:File.Create(路径);创建文件,返回FileStream FileStream fs = File.Create(路径 ...
- 计算机目录读取,从项目目录中读取SQL查询文件(Read SQL query file from project directory)...
从项目目录中读取SQL查询文件(Read SQL query file from project directory) 我在Visual Studio项目中放置了3个特别大的SQL查询,位于项目目录中 ...
- rmmod: can't change directory to '/lib/modules': No such file or directory问题解决
在使用rmmod命令时会出现rmmod: can't change directory to '/lib/modules': No such file or directory这个错误,经搜索得知,是 ...
- Can‘t find a suitable configuration file in this directory or any parent. 报错解决错误
docker-compose 执行的时候报错 Can't find a suitable configuration file in this directory or any par ...
- 卸载驱动出现:rmmod: can't change directory to '/lib/modules': No such file or directory
rmmod: can't change directory to '/lib/modules': No such file or directory 新建目录/lib/modules #mkdir - ...
- warning: LF will be replaced by CRLF in The file will hav
git add . 添加的时候报 warning: LF will be replaced by CRLF in ........ The file will hav 经过网上查找得意解决 https ...
最新文章
- 写入和读取图片(c# asp.net sqlserver)
- 《Spark大数据分析实战》——1.4节弹性分布式数据集
- 一个简单的python爬虫(转)
- WinForm 之 程序启动不显示主窗体
- .NET 6 攻略大全(四)
- 知乎高赞:这个开挂神器简直了!
- 使用JMeter和Yourkit进行REST / HTTP服务的性能分析
- Mr.J--JS事件监听(捕获冒泡)
- window下安装好postgreSQL 9.3用cmd命令进入数据库(搞的我这个菜鸟只剩半条命)...
- FLUENT 汽车流场仿真分析-结构网格划分视频教程
- java毕业设计_基于java的毕业设计
- 定风波·三月七日(苏轼)
- 【PTA】【C语言】球体的表面积及体积
- 国产化操作系统安装OpenJDK Icedtea插件
- 个人网站建设流程攻略
- CSPS-S 模拟47
- 阿里云服务器最新价格表(标准收费报价表)
- If you insist running as root, then set the environment variable RUN_AS_USER=root before running thi
- java中string是什么意思_java中string什么意思
- arch linux键盘布局,达内培训之更改ArchLinux终端下的键盘布局
热门文章
- 临近年末,外贸业务员如何催单
- [iOS]打开外部链接
- 数据操作语言:DELETE语句
- 在 Istio 服务网格中使用 Argo Rollouts 实现智能的渐进式发布
- 微服务进阶(四):Spring Cloud netflix概览及架构设计
- python递归函数1到n求和_python代码之阶乘求和的方法
- Linux中强制结束一个进程的终极方法和其他常用命令
- 解决:module 'xlrd' has no attribute 'open_workbook'的报错
- FLeiss Kappa系数和Kappa系数的Python实现
- 《机械与电子》期刊简介