【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 \~$

相关推荐
未济3 天前
linux 配置环境变量
linux
傲世仙尊3 天前
目录即文件-Ext文件系统收尾篇
linux·c语言
虎头金猫3 天前
4K 视频总卡在公网带宽?用 N1 + OpenList 把网盘播放链路重新理顺
运维·服务器·网络·python·容器·beautifulsoup·pandas
_艾伦 耶格尔.3 天前
进程间通信
linux
AI职业加油站3 天前
AI智能体应用工程师证书:政策红利下的职业新风口
大数据·运维·人工智能·学习·职场发展
Liuqy-053 天前
Linux IO编程——静态库、动态库
linux
此冬歌咏3 天前
K8s 节点故障实战:优雅驱逐 31 秒,硬故障 331 秒,以及那个永远 Pending 的 Pod
运维·k8s
彧azz3 天前
Linux 环境下 Redis 学习总结:数据类型、持久化、锁、事务、主从与缓存问题
linux·redis·笔记·学习·面试
-梅3 天前
linux(8) 软硬链接
linux·运维·服务器
AIgorithmGEEK3 天前
[Linux]线程三部曲(上):一个执行流的诞生——从操作系统一路拆到 pthread_create
linux·线程·pid