为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
相关推荐
EverydayJoy^v^39 分钟前
RH134学习进程——十二.运行容器(1)
linux·运维·容器
b***25111 小时前
电池组PACK自动化生产线的关键流程与核心优势
运维·自动化
郝亚军2 小时前
如何在Ubuntu和win10/11之间通过samba访问对方的文件
linux·服务器·ubuntu
哲伦贼稳妥3 小时前
职场发展-遇到以下情况请直接准备后手吧
运维·经验分享·其他·职场和发展
Exquisite.3 小时前
企业高性能web服务器(4)
运维·服务器·前端·网络·mysql
北塔软件3 小时前
北塔方案 | 政府行业IT运维解决方案
运维·it运维·解决方案·政务
cg_ssh4 小时前
Docker 下启动 Nacos 3.1.1 单机模式
运维·docker·容器
修己xj4 小时前
使用 Docker 部署 SQL Server 并导入 .mdb 文件的完整指南
运维·docker·容器
郝亚军5 小时前
ubuntu-18.04.6-desktop-amd64安装步骤
linux·运维·ubuntu
Web极客码6 小时前
CentOS 7.x如何快速升级到CentOS 7.9
linux·运维·centos