为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
相关推荐
chenzfp1 天前
【运维】鲲鹏麒麟V10 操作系统aarch64自制OpenSSH 9.8p1 rpm包 ssh漏洞修复
运维·ssh
TG_yunshuguoji1 天前
亚马逊云代理商:AWS怎么通过加密实现数据保护目标?
服务器·云计算·aws
6190083361 天前
linux 安装jdk
java·linux·运维
可涵不会debug1 天前
UU远程深度测评:重构远程控制体验的“无套路”标杆
运维·服务器
峰顶听歌的鲸鱼1 天前
1.云计算与服务器基础
运维·服务器·笔记·云计算·学习方法
IDOlaoluo1 天前
dotnet-sdk-5.0.400-linux-x64.tar.gz 安装教程(Linux 手动安装 .NET 5.0.400 SDK 步骤)
运维·服务器
2501_915918411 天前
iOS 混淆与 IPA 加固一页式行动手册(多工具组合实战 源码成品运维闭环)
android·运维·ios·小程序·uni-app·iphone·webview
扶尔魔ocy1 天前
【DIY】RS232串口监听头制作
运维·rs232
迎風吹頭髮1 天前
Linux服务器编程实践60-双向管道:socketpair函数的实现与应用场景
linux·运维·服务器
AORO20251 天前
航运、应急、工业适用,AORO P1100三防平板引领行业数字化变革
运维·服务器·网络·智能手机·电脑·信息与通信