导航:首页 > 程序命令 > 终端sudo命令

终端sudo命令

发布时间:2022-12-29 05:16:20

⑴ ubuntu开机执行sudo

bashrc文件中按你原来的命令改写。
udo chown usrname -R /dev/kvm //原命令echo password | sudo -S chown usrname -R /dev/kvm //改写。注:这里password是密码,参数-S专门为执行sudo命令的时候要输入密码而准备的,表示标准输入。当然这种方法是极不好的,直接把密码写入了 .bashrc 文件中。而且虽然不用输入密码,但是每次终端会有输出符的残留。
需要开机执行的sudo命令可以写在/etc/rc.local中,因为/etc/rc.local是以root身份去执行的。系统在启动时会先调用/etc/init.d/rc.local,在/etc/init.d/rc.local脚本中再调用/etc/rc.local。可见,首先要必须先保证/etc/rc.local对root具有可执行权限。通过sudo chmod u+x /etc/rc.local后,即可往/etc/rc.local中添加sudo命令实现开机自动执行了、

⑵ sudo rm -rf /*是什么意思

递归删除根分区,就是删除所有文件,包括操作系统的本身。

sudo是linux系统管理指令,是允许系统管理员让普通用户执行一些或者全部的root命令的一个工具;如halt,reboot,su,它不仅减少了root用户的登陆和管理时间,同样也提高了安全性,这个命令的作用是调用root的权限去执行一些高级别权限的命令。

sudo可使一般用户不需要知道超级用户的密码即可获得权限。将普通用户的名字、可以执行的特定命令、按照哪种用户或用户组的身份执行等信息,登记在特殊的文件中(通常是/etc/sudoers),即完成对该用户的授权(此时该用户称为“sudoer”)。

在一般用户需要取得特殊权限时,其可在命令前加上“sudo”,将会询问该用户自己的密码(以确认终端机前的是该用户本人),回答后系统,即会将该命令的进程以超级用户的权限运行。之后的一段时间内,使用sudo不需要再次输入密码。

以上资料参考:网络——rm




⑶ 求助在终端中输入sudo

产生问题的原因是你调整了分区,导致分区号改变,grub无法找到引导配置文件就会出现rescue。输入set root那些就是告诉grub去哪找到内核文件引导进入系统。 其实,你说的easybcd引导(实际就是windows的引导)菜单没丢失,只要你能选择引导windows,这个菜单就会出现。所以你现在可以有两个选择: 1、用grub引导双系统,grub rescue后输入命令进入Ubuntu后,终端运行sudo update-grub就可以了,会自动配置引导双系统。如果运行结束看提示没有找到windows,先安装os-prober再update-grub。 2、在完成上面的grub修复后,重启进PE用分区软件重建mbr,恢复默认的windows系统引导,重启就会出现你所说的easybcd的引导菜单了,选择ubuntu看看能不能进入,如果不行,需要进win然后运行easybcd删除原来的ubuntu启动项,重新再添加新的ubuntu引导项。

⑷ Mac OS X 10.11 sudo 指令出问题了么

终端输入sudo -s 再输密码

OSXElCapitan中,在内核下引入了Rootless机制,以下路径:/System/bin/sbin/usr(except/usr/local)均属于Rootless范围,即使root用户无法对此目录有写和执行权限,只有Apple以及Apple授权签名的软件(包括命令行工具)可以修改此目录。要么思考你这个操作的意义之后,使用其他方式完成你的操作比如你要改vim的配置,请放在~/.vim/中,而不是/usr/share这种全局路径要么关闭Rootless(非开发者一般不推荐,或者建议执行后再次开启)附关闭方法:重启,开机按住Command+R,以Recovery分区启动,然后选择以下方式:图形化操作在SecurityConfiguration中关闭命令行操作csrutildisable

⑸ Ubuntu中实行终端命令sudo apt install tree无法定位软件包是什么意思

tree软件的下载源没找到。
1、尝试使用sudo apt-get update更新新源列表
2、之后再次执行sudo apt-get install tree

⑹ 普通用户怎么切换sudo指令 sudo指令又怎么切换普通用户指令

在普通用户下,打开终端输入sudo passwd root,然后会提示你输入密码,这个是普通用户的密码,然后还有两次密码是输入root的新密码,一次输入一次是确认的,输入完成后root就开通了,然后注销重新切换用户登录到root用户就好了,登录界面会出现你的普通用户和other user,选择other user然后输入root和密码就好了。

⑺ 如何打开android命令行终端

1、连接电脑上,用adb打开,android命令行终端即可。

(7)终端sudo命令扩展阅读:

终端命令sudo: Executing Commands with Elevated Privileges 执行命令特权 sudo是允许系统管理员让普通用户执行一些或者全部的root命令的一个工具,如halt,reboot,su等等。这样不仅减少了root用户的登陆 和管理时间,同样也提高了安全性。Sudo不是对shell的一个代替,它是面向每个命令的。

app_0是用户名,也就是终端在系统中的名字。android是主机名/ 表示当前路径。

这些信息存储在变量PS1中,自己可以改变。改成彩色更加美观,而且输入命令后更加容易找到提示符。有一个重要的基本变量是PATH,这叫命令搜索路径。

⑻ 【Mac】使用sudo命令时提示:command not found

在mac终端上使用sudo命令时,提示command not found。

最开始网络的一个方式,说是修改/etc/sudoers文件, 参考链接 ,可是我发现我根本打不开这个文件。

于是又开始探索另一个方法,不直接使用sudo,而是用 su root。

⑼ Linux操作系统下Sudo命令的使用方法

sudo命令格式如下:

sudo -K | -L | -V | -h | -k | -l | -vsudo [-HPSb] [-a auth_type] [-c
class|-] [-p prompt] [-u username|#uid] {-e file [...] | -i | -s | command}

下面我们再来看一下sudo其它常用的一些参数:

选项 含义 作用
sudo -h Help 列出使用方法,退出。
sudo -V Version 显示版本信息,并退出。
sudo -l List 列出当前用户可以执行的命令。只有在sudoers里的用户才能使用该选项。
sudo -u username|#uid User 以指定用户的身份执行命令。后面的用户是除root以外的,可以是用户名,也可以是#uid。

sudo -k Kill 清除“入场卷”上的时间,下次再使用sudo时要再输入密码。

sudo -K Sure kill 与-k类似,但是它还要撕毁“入场卷”,也就是删除时间戳文件。

sudo -b command Background 在后台执行指定的命令。
sudo -p prompt command Prompt 可以更改询问密码的提示语,其中%u会代换为使用者帐号名称,%h会显示主机名称。非常人性化的设计。
sudo -e file Edit 不是执行命令,而是修改文件,相当于命令sudoedit

⑽ Linux操作系统下Sudo命令的使用方法

建议:
在Linux系统下,右键打开终端后,可以输入"man sudo"或者"info sudo"查询,因为使用方法实在是太多,可以摘要如下,其他可以自己查看。
NAME
sudo, sudoedit - execute a command as another user

SYNOPSIS
sudo -h | -K | -k | -L | -l | -V | -v

sudo [-bEHPS] [-p prompt] [-u username|#uid] [VAR=value]
{-i | -s | command}

sudoedit [-S] [-p prompt] [-u username|#uid] file ...

OPTIONS
sudo accepts the following command line options:

-b The -b (background) option tells sudo to run the given command in
the background. Note that if you use the -b option you cannot use
shell job control to manipulate the process.

-E The -E (preserve environment) option will override the env_reset
option in sudoers(5)). It is only available when either the
matching command has the SETENV tag or the setenv option is set in
sudoers(5).

-e The -e (edit) option indicates that, instead of running a command,
the user wishes to edit one or more files. In lieu of a command,
the string "sudoedit" is used when consulting the sudoers file. If
the user is authorized by sudoers the following steps are taken:

1. Temporary copies are made of the files to be edited with the
owner set to the invoking user.

2. The editor specified by the VISUAL or EDITOR environment vari-
ables is run to edit the temporary files. If neither VISUAL
nor EDITOR are set, the program listed in the editor sudoers
variable is used.

3. If they have been modified, the temporary files are copied back
to their original location and the temporary versions are
removed.

If the specified file does not exist, it will be created. Note
that unlike most commands run by sudo, the editor is run with the
invoking user's environment unmodified. If, for some reason, sudo
is unable to update a file with its edited version, the user will
receive a warning and the edited will remain in a temporary
file.

-H The -H (HOME) option sets the HOME environment variable to the
homedir of the target user (root by default) as specified in
passwd(5). By default, sudo does not modify HOME (see set_home and
always_set_home in sudoers(5)).

-h The -h (help) option causes sudo to print a usage message and exit.

-i The -i (simulate initial login) option runs the shell specified in
the passwd(5) entry of the user that the command is being run as.
The command name argument given to the shell begins with a '-' to
tell the shell to run as a login shell. sudo attempts to change to
that user's home directory before running the shell. It also ini-
tializes the environment, leaving TERM unchanged, setting HOME,
SHELL, USER, LOGNAME, and PATH, and unsetting all other environment
variables. Note that because the shell to use is determined before
the sudoers file is parsed, a runas_default setting in sudoers will
specify the user to run the shell as but will not affect which
shell is actually run.

-K The -K (sure kill) option is like -k except that it removes the
user's timestamp entirely. Like -k, this option does not require a
password.

-k The -k (kill) option to sudo invalidates the user's timestamp by
setting the time on it to the Epoch. The next time sudo is run a
password will be required. This option does not require a password
and was added to allow a user to revoke sudo permissions from a
.logout file.

-L The -L (list defaults) option will list out the parameters that may
be set in a Defaults line along with a short description for each.
This option is useful in conjunction with grep(1).

-l The -l (list) option will list out the allowed (and forbidden) com-
mands for the invoking user on the current host.

-P The -P (preserve group vector) option causes sudo to preserve the
invoking user's group vector unaltered. By default, sudo will ini-
tialize the group vector to the list of groups the target user is
in. The real and effective group IDs, however, are still set to
match the target user.

-p The -p (prompt) option allows you to override the default password
prompt and use a custom one. The following percent ('%') escapes
are supported:

%H expanded to the local hostname including the domain name (on if
the machine's hostname is fully qualified or the fqdn sudoers
option is set)

%h expanded to the local hostname without the domain name

%p expanded to the user whose password is being asked for
(respects the rootpw, targetpw and runaspw flags in sudoers)

%U expanded to the login name of the user the command will be run
as (defaults to root)

%u expanded to the invoking user's login name

%% two consecutive % characters are collapsed into a single %
character

-S The -S (stdin) option causes sudo to read the password from the
standard input instead of the terminal device.

-s The -s (shell) option runs the shell specified by the SHELL envi-
ronment variable if it is set or the shell as specified in
passwd(5).

-u The -u (user) option causes sudo to run the specified command as a
user other than root. To specify a uid instead of a username, use
#uid. When running commands as a uid, many shells require that the
'#' be escaped with a backslash ('\'). Note that if the targetpw
Defaults option is set (see sudoers(5)) it is not possible to run
commands with a uid not listed in the password database.
-V The -V (version) option causes sudo to print the version number and
exit. If the invoking user is already root the -V option will
print out a list of the defaults sudo was compiled with as well as
the machine's local network addresses.

-v If given the -v (validate) option, sudo will update the user's
timestamp, prompting for the user's password if necessary. This
extends the sudo timeout for another 5 minutes (or whatever the
timeout is set to in sudoers) but does not run a command.

-- The -- flag indicates that sudo should stop processing command line
arguments. It is most useful in conjunction with the -s flag.

Environment variables to be set for the command may also be passed on
the command line in the form of VAR=value, e.g.
LD_LIBRARY_PATH=/usr/local/pkg/lib. Variables passed on the command
line are subject to the same restrictions as normal environment vari-
ables with one important exception. If the setenv option is set in
sudoers, the command to be run has the SETENV tag set or the command
matched is ALL, the user may set variables that would overwise be for-
bidden. See sudoers(5) for more information.

阅读全文

与终端sudo命令相关的资料

热点内容
dvd光盘存储汉子算法 浏览:757
苹果邮件无法连接服务器地址 浏览:963
phpffmpeg转码 浏览:671
长沙好玩的解压项目 浏览:145
专属学情分析报告是什么app 浏览:564
php工程部署 浏览:833
android全屏透明 浏览:737
阿里云服务器已开通怎么办 浏览:803
光遇为什么登录时服务器已满 浏览:302
PDF分析 浏览:485
h3c光纤全工半全工设置命令 浏览:143
公司法pdf下载 浏览:382
linuxmarkdown 浏览:350
华为手机怎么多选文件夹 浏览:683
如何取消命令方块指令 浏览:350
风翼app为什么进不去了 浏览:778
im4java压缩图片 浏览:362
数据查询网站源码 浏览:150
伊克塞尔文档怎么进行加密 浏览:892
app转账是什么 浏览:163