为Ubuntu18.04云服务器修改用户shell

目录

  • [1 背景](#1 背景)
  • [2 修改用户shell](#2 修改用户shell)

1 背景

在Ubuntu18.04的云服务器,创建一个普通账户,登录进行发现使用shell是sh而不是bash,sh对终端命令支持很不好,将用户的shell修改为bash.

2 修改用户shell

这里假定用户名为james,修改命令如下:

bash 复制代码
$ sudo chsh -s  /bin/bash james
$ sudo cp /root/.bashrc ./
$ sudo cp /root/.profile ./
$ sudo chown james .bashrc
$ sudo chown james .profile
$ sudo chgrp james .bashrc
$ sudo chgrp james .profile

说明:

  • 需要将/root目录下.bashrc和.profile复制过来,同时修改器own和group
  • 修改成功,重新登录如下:
bash 复制代码
Welcome to Ubuntu 18.04.6 LTS (GNU/Linux 4.15.0-213-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Wed Jun 26 10:50:37 CST 2024

  System load:  0.0               Processes:           115
  Usage of /:   8.4% of 39.07GB   Users logged in:     0
  Memory usage: 17%               IP address for eth0: 192.168.7.192
  Swap usage:   0%

 * Strictly confined Kubernetes makes edge and IoT secure. Learn how MicroK8s
   just raised the bar for easy, resilient and secure K8s cluster deployment.

   https://ubuntu.com/engage/secure-kubernetes-at-the-edge

Expanded Security Maintenance for Infrastructure is not enabled.

4 updates can be applied immediately.
1 of these updates is a standard security update.
To see these additional updates run: apt list --upgradable

113 additional security updates can be applied with ESM Infra.
Learn more about enabling ESM Infra service for Ubuntu 18.04 at
https://ubuntu.com/18-04

New release '20.04.6 LTS' available.
Run 'do-release-upgrade' to upgrade to it.


	
	Welcome to Huawei Cloud Service

Last login: Wed Jun 26 10:42:35 2024 from xxx.xxx.xxx.xxx
james@hcss-ecs-6914:~$ ls
相关推荐
秋风起,再归来~3 分钟前
【Linux庖丁解牛】—进程优先级!
linux·运维·服务器
Lalolander30 分钟前
设备制造行业如何避免项目管理混乱?
运维·制造·工程项目管理·四算一控·epc·环保设备工程·设备制造
LucianaiB1 小时前
【金仓数据库征文】_AI 赋能数据库运维:金仓KES的智能化未来
运维·数据库·人工智能·金仓数据库 2025 征文·数据库平替用金仓
prinrf('千寻)1 小时前
nacos设置权重进行负载均衡不生效
运维·负载均衡
Lary_Rock1 小时前
Android 编译问题 prebuilts/clang/host/linux-x86
android·linux·运维
子非衣1 小时前
Windows云主机远程连接提示“出现了内部错误”
服务器·windows
绵绵细雨中的乡音2 小时前
Linux进程学习【基本认知】
linux·运维·学习
lLinkl2 小时前
项目笔记2:post请求是什么,还有什么请求
服务器·网络协议·http
珹洺3 小时前
Linux操作系统从入门到实战(三)Linux基础指令(上)
linux·运维·服务器
再睡一夏就好3 小时前
Linux常见工具如yum、vim、gcc、gdb的基本使用,以及编译过程和动静态链接的区别
linux·服务器·c语言·c++·笔记