ubuntu 创建用户和创建共享文件夹

新建用户

执行sudo adduser yuwei过程中会要求输入密码,输入完密码后,后续的操作直接回车就行。

root@pang-PowerEdge-T640:/home/pang# sudo adduser yuwei
正在添加用户"yuwei"...
正在添加新组"yuwei" (1001)...
正在添加新用户"yuwei" (1001) 到组"yuwei"...
创建主目录"/home/yuwei"...
正在从"/etc/skel"复制文件...
输入新的 UNIX 密码: 
重新输入新的 UNIX 密码: 
passwd:已成功更新密码
正在改变 yuwei 的用户信息
请输入新值,或直接敲回车键以使用默认值
	全名 []: 
	房间号码 []: 
	工作电话 []: 
	家庭电话 []: 
	其它 []: 
这些信息是否正确? [Y/n] 
root@pang-PowerEdge-T640:/home/pang# 

添加root权限

sudo gedit /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults	env_reset
Defaults	mail_badpass
Defaults	secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root	ALL=(ALL:ALL) ALL
pan	ALL=(ALL:ALL) ALL
pang	ALL=(ALL:ALL) ALL
##添加root权限
yuwei	ALL=(ALL:ALL) ALL
wen	ALL=(ALL:ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo	ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d

添加shell

sudo gedit /etc/passwd
yuwei:x:1001:0:,,,:/home/yuwei:/bin/bash

最省事的创建用户指令

sudo useradd -r -m -s /bin/bash guojing

创建共享文件夹share

安装samba,执行sudo apt-get install samba

在根目录下创建share目录,执行sudo mkdir /share/

配置share目录的读写权限和访问权限,执行sudo gedit /etc/samba/smb.conf

[share]
path = /share
available = yes
browseable = yes
public = yes
writable = yes
guest ok = yes
create mask = 0777
diredtory mask = 0777
force user = nobody

重启共享服务,执行sudo /etc/init.d/smbd restart

你可能感兴趣的:(MTK,linux)