CentOS 7下Authentication failure问题

su 无法切换账户(密码正确)一直提示Authentication failure(认证失败) 场景 centOS7 依旧是解决上次赋权问题留下的bug 问题描述 su root命令无法切换。密码是正确的(我还重置root密码,具体可见另一篇博文) 最后,经过百度找到的解决办法 解决方法 登录root账户 执行以下命令ll -a /bin/su ll -a /usr/bin/passwd 观察显示的结果 -rwxr-xr-x. 1 root root 32096 Aug 4 ... 阅读详情

今天在CentOS中配置Hadoop的时候突然遇到使用普通用户无法切换到root用户的问题,即输入

$ su -

提示输入密码后无法切换到root用户,而是提示如下错误:

su: Authentication failure

这里写图片描述

好好地怎么出现这个问题了呢,百度了一下午基本上都是这个答案:

这个问题产生的原因是由于ubuntu系统默认是没有激活root用户的,需要我们手工进行操作,在命令行界面下,或者在终端中输入如下命令:

$ sudo passwd root

系统提示输入当前用户密码:
然后输入新的root密码:
确认新密码:
系统提示更新成功,OK!

虽然说的都是ubuntu系统,但死马当活马医,姑且照着做吧。

我先登录普通用户,输入

$ sudo passwd root

系统提示当前用户不在sudoers中,即没有权限。
那么换成root用户登录。这里要说明一下,我的系统普通用户和root用户分别登录都没有问题,问题是不能通过su命令切换。
在root用户下编辑sudoers文件:

# vim /etc/sudoers

在文件中添加如下语句,这里的njupt是我的普通用户:

# Allow njupt
njupt ALL=(ALL) ALL

保存,系统会提示文件是只读的,需要输入!强制保存,照做。

再试试这个命令

$ sudo passwd root

发现还是不行,会提示如下错误:

sudo: effective uid is not 0, is sudo installed setuid root?

这是因为sudo命令没有S(setuid)权限,因此其他用户执行sudo命令时,报上面错误。可以这样理解setuid权限:当一个具有可执行权限的文件设置SetUID权限后,其他用户执行这个文件时将以这个文件的所有者的身份进行执行。

为sudo命令设置setuid权限

$ chmod u+s  /usr/bin/sudo

然后看一下

[njupt@master bin]$ ll | grep sudo
-rwsrwxrwx. 1 root root    130720 Mar  6  2015 sudo

有了S权限以后再试试这个命令

$ sudo passwd root

发现提示信息改变了:

[njupt@master bin]$ sudo passwd root
sudo: /etc/sudoers is world writable
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin

这两条是新的错误信息

sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin

这是因为sudoers 文件的权限不对,正常的权限应该是440(r–r—–),我是因为之前瞎折腾的时候修改过这个文件的权限。现在改回来

# chmod 440 /etc/sudoers

# ll | grep sudo
-rw-r-----.  1 root root   1786 Mar  6  2015 sudo.conf
-r--r-----.  1 root root   4035 Sep 10 04:31 sudoers
drwxr-x---.  2 root root      6 Mar  6  2015 sudoers.d
-rw-r-----.  1 root root   3181 Mar  6  2015 sudo-ldap.conf

再一次执行这个命令

[njupt@master bin]$ sudo passwd root
[sudo] password for njupt: 
Changing password for user root.
New password: 
BAD PASSWORD: The password is shorter than 8 characters
Retype new password: 
passwd: all authentication tokens updated successfully.

successfully!难道这样就可以了?试试

[njupt@master bin]$ su -
Password: 
su: Authentication failure

绝望了好吧。。。

网上还有一种说法,说用这个命令:

$ sudo su

代替su命令。我试了一下,确实可以,而且不需要输入root密码,而是要输入普通用户的密码

[njupt@master bin]$ sudo su
[sudo] password for njupt: 
[root@master bin]# 

到此为止切换用户的问题算是解决了,但出现Authentication failure的根本原因还是不知道,而且su命令仍然无法使用。

以前明明是可以的(泪奔~)。

Vagrant安装Virtualbox CentOS :Warning: Authentication failure. Retrying...问题 近日遇到Vagrant安装VirtualBox 的CentOS镜像初始化失败问题。 环境: windows7 x64 ,vagrant 1.9.5,oracle vm virtualbox5.1.18 从官方源添加的box: vagrant box add generic/centos7 --provider=virtualbox 过程:设置好Vagrantfile... 阅读详情

相关推荐

centos7如何切换到root用户

在 CentOS 7 中,你可以通过几种方式切换到 root 用户。最常用的方法是使用su(switch user) 命令或者sudo命令。

舒一笑的博客 6965

【无标题】

centos 7.x, 输入su命令获取root权限时, 出现了 authentication failure 的问题,即身份验证失败。需要进行下面操作:修改root 密码,再su 到root ; sudo passwd root Enter new UNIX password: 此时输入你的密码 Retype new UNIX password: //再次输入,相同密码。 passwd: password updated successfully 此时再用su命令,就可以获取到root权限了。...

qq_49401685的博客 652

AWR1642+DCA1000EVM 不使用mmWave Studio软件采集原始ADC数据 Timeout问题汇总

DCA1000 EVM Timeout问题汇总

Jesy_Hsu的博客 1476

CentOS执行SU时 Authentication failure

在CentOS中执行SU时,报如下错误: [xxxxxx@centos10 ~]$ su Password: su: Authentication failure 解决方法: 如果确认root没有错误,使用以下方法: 1、登陆root账户; 2、分行sudo -i 3、执行chmod +s /bin/su

FanEok 1万+

SAP ERP 物料主数据同步外围系统

w_input-beskz = i_marc_new-beskz."采购类型 " BESKZ--- ADD BY HX_FHJ 20210106。w_input-beskz = lw_marc-beskz."采购类型 " BESKZ--- ADD BY HX_FHJ 20210106。w_input-sobsl = i_marc_new-sobsl."特殊采购类型-虚拟物料标识。

ChampaignWolf的专栏 1746

深入浅出:CosineLRScheduler 调度器的原理与实战应用

本文深入解析了CosineLRScheduler调度器的核心原理与实战应用,详细介绍了余弦退火算法及其在深度学习模型训练中的优势。通过参数配置建议、PyTorch实现示例和常见问题解决方案,帮助开发者高效应用该调度器提升模型性能,特别适用于计算机视觉和自然语言处理任务。

sss66的博客 859

Centos 普通用户su到root用户提示错误

一、CentOS7 普通用户执行su时,报如下错误: [test@ecs-1453 ~]$ su - Password: su: Authentication failure 解决方法: 如果root能够正常登陆,就先使用root用户登录系统,再执行操作 1、登陆root账户; 2、执行sudo -i [root@ecs-1453 ~]# sudo -i 3、执行chmod +...

友人A的博客 1万+

eCognition易康操作教程(一):如何利用eCognition易康软件进行影像分割之棋盘分割、四叉树分割、光谱差异分割

进程执行完成后,植被覆盖区域与裸地区域合并了。第三步:清除分割结果,点击“Image Objects”菜单栏,点击“Delete Level(s)”,选中“ResultLevel1”,点击”ok”删除棋盘分割结果。四叉树分割之后,有的正方形大一些,有的正方形小一些,大说明该区域的光谱特性更加均一,而小说明不太均一。Leve:选择运行算法的矢量层名称,这里选择四叉树分割算法得到的矢量层“ResultLevel2”。Image Layer weights:图层权重,这里设置为“1,1,1,1”。

蒹葭苍苍 4609

Parallel Desktop中按照的centos在切换root用户时,密码正确,但一直切换不成功,显示su: Authentication failure

在Parallels Desktop上 下载的 centos 默认用户名是parallels,它的密码是需要设置的,软件没有自动设置,密码必须大于8位,并且无法进行su命令,也就是无法切换到root用户,会提示 su: Authentication failure。 这是因为Parallels Desktop 在安装 centos 的时候是默认不激活root这个超级用户的,所以需要手动激活。 在终端中输入以下命令: ``` sudo passwd [sudo] password for parallel

cool-wangtongzhou 2414

8.26华为OD机试真题 新系统【仓库查询】

华为OD机试真题 新系统【仓库查询】,提供C语言、Java、C++、Python、Go、JavaScript源码实现,并提供完整思路讲解,以及在线OJ模拟做题。华为OD机试真题 【仓库查询】多语言题解。

qq_45776114的博客 548

免杀思路总结

免杀思路总结 1.免杀技术简介 1.免杀的重要性 2.免杀的难度 3.杀毒软件的排行 国外 国内 1 、Bitdefender 1、360 2 、Norton 360 2、智量安全(没测过,据说很厉害) 3 、Kaspersky 3、火绒安全 4 、Webroot 4、金山独霸 5 、Trend Micro 5

LiBai'S BLOG 1万+

CentOS7 下切换账号出现Authentication failure问题

曾梦想仗剑走天涯,因太菜取消原计划 最近玩Centos 下的Linux时候 出现如下情况也就是在密码正确下,切换用户失败,提示身份验证失败 what?之前都是好好的,想了想 估计是给elasticsearch的账号赋值权限时候太菜搞得叭~ 那么怎么解决呢?面向百度,Google解决问题来了 最终个人解决办法如下 用xshell登录root账号,先删除之前自己的用户es,组 elasticsearch如下 1.删除用户 命令 userdel [用户名] ## -r 是用户删除对应得es账号下的用.

Endleaf的博客 3159

详解Linux下使用vscode编译运行和调试C/C++

本教程将具体详解使用Visual Studio Code在Linux环境下使用C/C++方法。 GCC C++ 编译器 (g++) 和 GDB 调试器的方法。 GCC是GNU 编译器集合; GDB 是 GNU 调试器。 1.先决条件 安装Visual Studio Code. 安装C++拓展插件。点击在vscode界面最左侧的Extensions图标(打开快捷键:ctrl+shift+X),搜索“C/C++”,点击进行安装。 确保已安装gcc. 一般ubuntu系统会预装gcc.在终端窗口中输入如下命令

休的博客 6241

centos7系统 su: Authentication Failure

对文件的修改保存不了的话参考评论区,要先给权限。(user_name 是我的普通用户)修改密码,并不能解决最初的问题。centos7 进入单人模式。回到正常模式 sudo,报错。首先上网搜基本都是建议直接。可是如何进入单人模式呢?的问题没有解决,但是。可以先做为替代方案。可什么命令都执行不了。

qq_42785714的博客 1835

【UML】-- 期末试题题库含答案(各章题目、选择题、填空题、简答题、画图题)

每章都有对应的题目和答案,选择题,填空简答,大题,答案已标红,方便大家观看

个人博客 1万+

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

tigerVNC的简单使用教程(CentOS的远程桌面连接)[解决Authentication Failure问题]

参照教程: http://blog.youkuaiyun.com/daydreamingboy/article/details/8196747/ 开始连接CentOS远程桌面连接 但是出现Authentication Failure的情况 解决办法: 是因为vnc用一套自己的密码系统,不要去输入ssh登录时的密码,所以只需要进入远程服务器中,设置一哈vnc的密码即可!$ vncpasswd搞定收工!常

医学影像学习笔记 1万+

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

centos7 Authentication failure

root@localhost ~]#subash-4.2$ su Password: su: Authentication failure //这里切换的是系统用户,现在还不清楚为什么postgres成了我的系统用户 bash-4.2$ su Password: [root@localhost ~]# //qie huan yong hu: [ro...

dongchan1847的博客 957

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

su : Authentication failure

sudo passwd 命令,解决 Authentication failure 错误。

深入挖掘,筑基为先;知其然,知其所以然。 1499

su: Authentication failure问题

问题: su命令不能切换root,提示错误su: Authentication failure 解决: 使用命令 sudo passwd root 下次再su的时候只要输入密码就可以成功登录了。 转载于:https://www.cnblogs.com/1228073191Blog/p/10717745.html...

weixin_33691817的博客 522

CentOS7root账户

CentOS7root账户切换失败Authentication failure 由于CentOS7默认没有开通root账户,需要使用安装时创建的用户进行修改。 sudo passwd We trust you have received the usual lecture from the local System Administrator. It usually boils down ...

shuaibizi的博客 1969

win7加入linux的域环境,CentOS 7加入Windows域的问题

一个比较烧脑的问题,哪位遇到过类似的?CentOS7虚拟机,用realmjoin--user=user1@abc.com-vabc.com加入Windows域,输入user1的密码正常加入域,之后ssh、su切换任意域用户都正常,然后某一天开始,user1帐号不能再登录,其他域帐号均正常。在AD域控服务器上检查user1状态正常,在其他Windows、使用LDAP的系统里登录user...

weixin_32620265的博客 239

保姆级教程:在CentOS 7上为Zabbix 5.0配置SNMP服务,监控华为交换机就这么简单

本文提供了一份详细的保姆级教程,指导用户在CentOS 7上为Zabbix 5.0配置SNMP服务,特别针对华为交换机的监控需求。通过SNMPv2协议,用户可以轻松实现设备状态监控,包括安装配置、安全加固、Zabbix集成及常见问题排查,全面提升网络运维效率。

weixin_30907935的博客 305

su: Authentication failure

Szq797的博客 246

centos7 mysql 开机自动启动失败_CentOS 7下MySQL服务启动失败的解决思路

今天,启动MySQL服务器失败,如下所示:[root@spark01 ~]# /etc/init.d/mysqld startStarting mysqld (via systemctl): Jobfor mysqld.service failed because the control process exited with error code. See "systemctl status ...

weixin_33220360的博客 648
上一篇: CentOS7修改主机名
下一篇: windows+vmware+centos7+hadoop2.7搭建伪分布式集群
评论 11
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值