To list all users you can use:

cut -d: -f1 /etc/passwd

To add a new user you can use:

sudo adduser new_username

To remove/delete a user, first you can use:

sudo userdel username

Then you may want to delete the home directory for the deleted user account :

sudo rm -r /home/username

(Please use with caution the above command!)

To modify the username of a user:

usermod -l new_username old_username

To change the password for a user:

sudo passwd username

To change the shell for a user:

sudo chsh username

To change the details for a user (for example real name):

sudo chfn username

$ whoami
user1
$ su - user2
Password:
$ whoami
user2
$ exit
logout To add a user with root permission
sudo adduser <username>
sudo adduser <username> sudo

sudo groupadd vivek
sudo useradd -g vivek -G www-data,ftp vivek
sudo passwd vivek
 
echo 'yang ALL=(ALL) ALL' >> /etc/sudoers

 
 

Ubuntu user switch的更多相关文章

  1. iOS-C基础

    iOS开发系列--C语言之基础知识 概览 当前移动开发的趋势已经势不可挡,这个系列希望浅谈一下个人对IOS开发的一些见解,这个IOS系列计划从几个角度去说IOS开发: C语言 OC基础 IOS开发(i ...

  2. Ubuntu安装Gnome3

    参考:How To Install GNOME In Ubuntu 14.04 . Ubuntu11.10安装GNOME3,卸载UNITY和UNITY2D操作 和How to install Gnom ...

  3. ubuntu入门

    Ubuntu的发音 Ubuntu,源于非洲祖鲁人和科萨人的语言,发作 oo-boon-too 的音.了解发音是有意义的,您不是第一个为此困惑的人,当然,也不会是最后一个:) 大多数的美国人读 ubun ...

  4. Switch&NAT 测试

    测试环境: PC1:Windows10 iperf3 PC2:Ubuntu iperf3 都装有千兆网卡,直连的iperf速度是935Mbps. 因为TXRX两个方向的数据是差不多的,下面的测试数据只 ...

  5. How To Set Up an OpenVPN Server on Ubuntu 14.04

    Prerequisites The only prerequisite is having a Ubuntu 14.04 Droplet established and running. You wi ...

  6. How to create vlan on Linux (with Cisco Catalyst Switch)

    In this article I want to share to you on how to create and configure vlan on Linux through Cisco Ca ...

  7. ubuntu一些基本软件安装方法

    ubuntu一些基本软件安装方法 首先说明一下 ubuntu 的软件安装大概有几种方式:1. deb 包的安装方式deb 是 debian 系 Linux 的包管理方式, ubuntu 是属于 deb ...

  8. ubuntu包管理

    查看某个文件属于哪个包dpkg -S add-apt-repository 包名software-properties-common命令名/usr/bin/add-apt-repository/usr ...

  9. ubuntu 14.04 compiz的ALT + TAB切换程序

    安装完ubuntu,发现不能使用ALT + TAB切换应用程序,翻遍所有百度结果,没有可行,都是拷这个拷那个...真实无语...FQgoogle,看的第一个就完美解决.记录下来,方便国人少走弯路. 首 ...

随机推荐

  1. Extract Stylish styles and save as JSON format

    Introduction Stylish is a easy browser extension/plugin for users to customizing the web page stylin ...

  2. php连接Access数据库错误及解决方法

    <?php $connstr="DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath("data.m ...

  3. php,js清除cookie

    目的通过控制cookie中的是否有莫个值实现是否跳转重定向 http方式 <?php if ($_COOKIE['test'] == 1) {  echo 'have cookie test'; ...

  4. java中快速排序的理解以及实例

    所谓的快速排序的思想就是,首先把数组的第一个数拿出来做为一个key,在前后分别设置一个i,j做为标识,然后拿这个key对这个数组从后面往前遍历,及j--,直到找到第一个小于这个key的那个数,然后交换 ...

  5. Java动态代理的两种实现方式:

    方式一:传统的代理 package cn.hc.domain; import java.lang.reflect.InvocationHandler; import java.lang.reflect ...

  6. session保存用户登录

    <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding= ...

  7. 设置MySQL自动增长从某个指定的数开始

    自增字段,一定要设置为primary key. 以指定从1000开始为例.1 创建表的时候就设置: CREATE TABLE `Test` ( `ID` int(11) NOT NULL AUTO_I ...

  8. hdu 4283 You Are the One 区间dp

    You Are the One Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  9. windows下MySQL 5.7+ 解压缩版安装配置方法

    方法来自伟大的互联网. 1.去官网下载.zip格式的MySQL Server的压缩包,根据需要选择x86或x64版.注意:下载是需要注册账户并登录的. 2.解压缩至你想要的位置. 3.复制解压目录下m ...

  10. sublime 3

    主题: Theme: Flatland 着色:todo Blue Dawn.tmTheme {     "theme": "Flatland Dark.sublime-t ...