为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
相关推荐
2401_868534782 小时前
软考网络规划设计师SSL协议知识点详解
服务器·网络
Escalating_xu2 小时前
【Linux 网络编程】手写序列化与反序列化:从 x op y 到能校验的文本协议
linux·运维·网络
润滑卫士2 小时前
油液多参数融合故障诊断:数据级融合与决策级融合方法
运维
李纲明4 小时前
WordPress 后台登录马上被踢回登录页:Cookie 域、HTTPS、盐值和页面缓存怎么查
运维·缓存·https·php·wordpress·cookie
todoitbo4 小时前
在 Ubuntu ARM64 上运行 Q1 V3.0 MuJoCo 模型:加载、步进和单执行器响应
linux·运维·ubuntu·ai·机器人·仿真教程·启元
AR-26710-4 小时前
Linux Day26——传输层与三次握手
linux·运维
额额额对了5 小时前
嵌入式 Linux 实战:i.MX6ULL 上的 CAN 通信与摄像头采集
linux·运维·服务器
RFID科技的魅力6 小时前
2026 年 RFID 资产标签批量制作怎么做?RFID 标签打印机实操指南
运维·人工智能·嵌入式硬件·物联网
灯澜忆梦6 小时前
【Linux】#10 | Linux 终端实用快捷键 + 安装应用
linux·运维·服务器
码士集团小青6 小时前
面霸篇:高频 Java 基础问题(核心卷一)
linux·服务器·数据库·redis·缓存·1024程序员节