【Linux】解决切换用户出现bash-4.2$问题

切换用户出现 bash 4.2 问题 
出现 bash 4.2 错误 发现是用户指定家目录下 缺少2个隐藏文件  

这题前提条件 我指定的家目录是 /opt/{孙悟空,猪八戒,唐僧,沙悟净}
/etc/skel/.bashrc  /etc/skel/.bash_profile   传过去后显示登录成功  

问题展示:
[root@localhost ~]# su sunwukong
bash-4.2$ ll
bash: ll: 未找到命令
bash-4.2$ 

更新隐藏文件  root用户下 
source ~/.bashrc
 source ~/.bash_profile

使用root用户登录,在用户指定的家目录中传入2个隐藏文件
cp  /etc/skel/.bashrc /opt/孙悟空
cp /etc/skel/.bash_profile /opt/孙悟空 
cp  /etc/skel/.bashrc /opt/沙悟净
cp  /etc/skel/.bash_profile /opt/沙悟净
cp  /etc/skel/.bashrc /opt/唐僧
cp  /etc/skel/.bash_profile /opt/唐僧
cp   /etc/skel/.bashrc /opt/猪八戒
cp  /etc/skel/.bash_profile /opt/猪八戒

登录效果:
[root@localhost sunwukong]# su sunwukong
[sunwukong@localhost ~]$ ll
总用量 0
[sunwukong@localhost ~]$ 

相关推荐

  1. Linux解决切换用户出现bash-4.2$问题

    2024-04-24 19:18:02       12 阅读
  2. Linux如何切换root用户

    2024-04-24 19:18:02       15 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-04-24 19:18:02       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-04-24 19:18:02       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-04-24 19:18:02       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-04-24 19:18:02       20 阅读

热门阅读

  1. 网络安全之数据库基础篇(基础入门)

    2024-04-24 19:18:02       14 阅读
  2. js 制作qq、微信 的表情

    2024-04-24 19:18:02       13 阅读
  3. 【PyTorch】3-基础实战(ResNet)

    2024-04-24 19:18:02       10 阅读
  4. 数仓建模—大数据建模

    2024-04-24 19:18:02       13 阅读
  5. Django的ORM使用filter以及Paginator分页器

    2024-04-24 19:18:02       10 阅读
  6. RTT学习

    2024-04-24 19:18:02       10 阅读
  7. 模糊视频图像智能处理

    2024-04-24 19:18:02       10 阅读
  8. 【软件工程中的螺旋模型】

    2024-04-24 19:18:02       13 阅读
  9. [Android]SharedPreferences可视化管理key-value数据存储

    2024-04-24 19:18:02       10 阅读
  10. python 小知识:enumerate、iterator用法与区别

    2024-04-24 19:18:02       12 阅读
  11. 每日一练 | 华为认证真题练习Day220

    2024-04-24 19:18:02       12 阅读