为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
相关推荐
Justice link43 分钟前
K8S基本配置
运维·docker·容器
观熵43 分钟前
SaaS 系统的自动化部署结构设计实战指南:基于 K8s + Helm 的工程落地路径
运维·kubernetes·自动化·saas 架构
chinesegf44 分钟前
ubuntu中虚拟环境的简单创建和管理
linux·运维·ubuntu
若涵的理解44 分钟前
一文读懂K8S kubectl 命令,运维小白必看!
运维·docker·kubernetes
java_logo1 小时前
2025 年 11 月最新 Docker 镜像源加速列表与使用指南
linux·运维·docker·容器·运维开发·kylin
峰顶听歌的鲸鱼2 小时前
Kubernetes管理
运维·笔记·云原生·容器·kubernetes·云计算
霖霖总总2 小时前
[小技巧42]InnoDB 索引与 MVCC 的协同工作原理
运维·数据库·mysql
CRMEB系统商城2 小时前
CRMEB多商户系统(PHP)- 移动端二开之基本容器组件使用
运维·开发语言·小程序·php
小镇学者2 小时前
【python】python项目是如何部署到服务器上的
服务器·python·github
HIT_Weston2 小时前
103、【Ubuntu】【Hugo】搭建私人博客:搜索功能(四)
linux·运维·ubuntu