首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >当我使用sudo命令时,它返回“无法打开/etc/scl/前缀/devtoolset-9!”

当我使用sudo命令时,它返回“无法打开/etc/scl/前缀/devtoolset-9!”
EN

Unix & Linux用户
提问于 2022-09-24 11:32:33
回答 1查看 606关注 0票数 2

我的系统是RHEL6.7,echo $PATH输出

代码语言:javascript
复制
[geoeast@hp2-12 ~]$ which rm
rm:      aliased to rm -i
[geoeast@hp2-12 ~]$ which cp
cp:      aliased to cp -i
[geoeast@hp2-12 ~]$ echo $PATH
/soft/geoeast4.0.3/opt/lightning/build/Linux.x86_64/bin:/soft/geoeast4.0.3/opt/gstomo/Linux.x86_64/bin:/soft/geoeast4.0.3/opt/diva/bin:/soft/geoeast4.0.3/opt/lightning/build/Linux.x86_64/bin:/soft/geoeast4.0.3/opt/diva/bin:/soft/geoeast4.0.3/opt/gstomo/Linux.x86_64/bin:/soft/geoeast4.0.3/support/fontforge/bin:/soft/geoeast4.0.3/support/tools/bin:.:/soft/geoeast4.0.3/bin/cw:/soft/geoeast4.0.3/bin/GeoGME:/soft/geoeast4.0.3/bin/vsp:/soft/geoeast4.0.3/bin/sfp:/soft/geoeast4.0.3/bin/sdp/cshell:/soft/geoeast4.0.3/bin/sdppy:/soft/geoeast4.0.3/bin/statics:/soft/geoeast4.0.3/bin/sdp/bin:/soft/geoeast4.0.3/bin/sdp/int:/soft/geoeast4.0.3/bin/sdp:/soft/geoeast4.0.3/bin/mc:/soft/geoeast4.0.3/bin/cw:/soft/geoeast4.0.3/bin/ggi:/soft/ieco1.0.3/support/zookeeper/bin:/soft/ieco1.0.3/support/hadoop/hadoop-2.7.2/bin:/soft/ieco1.0.3/support/hadoop/hadoop-2.7.2/sbin:/soft/ieco1.0.3/install:/soft/ieco1.0.3/bin/batp:/soft/ieco1.0.3/bin/nap:/soft/ieco1.0.3/bin/ndp:/soft/ieco1.0.3/bin/ncp:/soft/ieco1.0.3/bin/ncld:/soft/ieco1.0.3/bin/common:/soft/ieco1.0.3/GeoSeisIO/bin:/soft/ieco1.0.3/ivtms/console:/soft/ieco1.0.3/licmng/bin:/soft/ieco1.0.3/support_2.6.32/tools/bin:/soft/ieco1.0.3/support_2.6.32/python/gbin:/soft/ieco1.0.3/support_2.6.32/cwp/bin:/soft/ieco1.0.3/support_2.6.32/mojoview/bin:/soft/ieco1.0.3/support_2.6.32/DDS.2011-07-15/bin:/soft/ieco1.0.3/support_2.6.32/PCG/bin:/soft/ieco1.0.3/support_2.6.32/gslib90/bin:/soft/ieco1.0.3/support_2.6.32/qcad:/soft/ieco1.0.3/support_2.6.32/qt3/bin:/soft/ieco1.0.3/support_2.6.32/ImageMagick/bin:/soft/ieco1.0.3/support_2.6.32/jdk/bin:/soft/ieco1.0.3/support_2.6.32/mysql/bin:/soft/ieco1.0.3/support_2.6.32/oiv/bin:/soft/ieco1.0.3/support_2.6.32/ora/bin:/soft/ieco1.0.3/support_2.6.32/postgresql/bin:/soft/ieco1.0.3/support_2.6.32/mvapich2.tcp/bin:/soft/ieco1.0.3/support_2.6.32/devtoolset-9_as6/root/usr/bin:/usr/local/bin:/bin:/usr/bin:/usr/kerberos/sbin:/usr/kerberos/bin

下面是一个例子:

代码语言:javascript
复制
[geoeast@hp2-12 /tmp]$ sudo rm test2
Unable to open /etc/scl/prefixes/devtoolset-9!

sudo cp -a返回相同的错误。

代码语言:javascript
复制
[geoeast@hp2-12 /tmp]$ sudo cp -a seismicview.log seismicview.log2
Unable to open /etc/scl/prefixes/devtoolset-9!

它与另一个用户一起工作:

代码语言:javascript
复制
[geoeast@hp2-12 /tmp]$ su geou1
Password: 
[geou1@hp2-12 /tmp]$ sudo cp -a seismicview.log seismicview.log2
[sudo] password for geou1: 
[geou1@hp2-12 /tmp]$ 

geou1 echo $PATH输出

代码语言:javascript
复制
[geou1@hp2-12 /tmp]$ echo $PATH
.:/soft/geoeast3.0.5/support/fcitx/bin:/soft/geoeast3.0.5/support/fcitx/bin:/soft/geoeast3.0.5/bin/cw:/soft/geoeast3.0.5/GJSS/bin:/soft/geoeast3.0.5/support/ora/bin:/soft/geoeast3.0.5/bin/dp:/soft/geoeast3.0.5/GeoSeisIO/bin:/soft/geoeast3.0.5/bin/jsf:/soft/geoeast3.0.5/bin/vsp:/soft/geoeast3.0.5/bin/sfp:/soft/geoeast3.0.5/bin/sdp/int:/soft/geoeast3.0.5/bin/sdp/cshell:/soft/geoeast3.0.5/bin/sdp/bin:/soft/geoeast3.0.5/bin/systools:/soft/geoeast3.0.5/bin/mc:/soft/geoeast3.0.5/bin/cw:/soft/geoeast3.0.5/bin/gsm:/soft/geoeast3.0.5/bin/GJSS/gjssgui:/soft/geoeast3.0.5/bin/GJSS:/soft/geoeast3.0.5/bin/ggi:/soft/geoeast3.0.5/support/firefox:/soft/geoeast3.0.5/support/qcad:/soft/geoeast3.0.5/support/Adobe/Reader9/bin:/soft/geoeast3.0.5/support/Firefly/Client/bin:/soft/geoeast3.0.5/support/jdk/bin:/soft/geoeast3.0.5/support/qt3/bin:/soft/geoeast3.0.5/support/mysql/bin:/soft/geoeast3.0.5/support/oiv/bin:/soft/geoeast3.0.5/support/ora/bin:/soft/geoeast3.0.5/support/postgresql/bin:/soft/geoeast3.0.5/support/ImageMagick/bin:/soft/geoeast3.0.5/support/tools/bin:/soft/geoeast3.0.5/support/pyt/bin:/soft/geoeast3.0.5/support/mpi/bin:/soft/geoeast3.0.5/support/cwp/bin:/soft/geoeast3.0.5/support/cuda/bin:/soft/geoeast3.0.5/support/petsc/bin:/soft/geoeast3.0.5/support/mojoview/bin:/soft/geoeast3.0.5/support/paraview/bin:/usr/local/bin:/bin:/usr/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/sbin:/usr/GNQS/sbin:/usr/GNQS/bin

要使sudo命令工作,我应该做些什么?

EN

回答 1

Unix & Linux用户

发布于 2022-09-24 17:30:39

生成错误的用户帐户,Unable to open /etc/scl/prefixes/devtoolset-9!在其$PATH (搜索命令的目录列表)中有目录/soft/ieco1.0.3/support_2.6.32/devtoolset-9_as6/root/usr/bin。另一方面,成功工作的用户帐户geou1不包含此目录。

因此,我推测您的第一个用户正在执行的sudo实际上就在这个额外的目录中,而正是这个目录试图访问/etc/scl/prefixes/devtoolset-9。(您可以使用type sudo检查这一点,并确认它不在/usr/bin中。)

这些目录看起来像是由机构添加的,所以打赌的解决方案是向IT Servicedesk或系统管理员报告问题,让他们修复。

另一种方法可能是从/soft/ieco1.0.3/support_2.6.32/devtoolset-9_as6/root/usr/bin目录中删除$PATH,这样就不会执行非官方版本的sudo。然而,我不能告诉你,这可能会打破什么。

代码语言:javascript
复制
PATH=$(echo "$PATH" | sed 's!:/soft/ieco1.0.3/support_2.6.32/devtoolset-9_as6/root/usr/bin:!:!g')

当您在那里时,我强烈建议您从您的.目录列表中删除$PATH

代码语言:javascript
复制
PATH=$(echo "$PATH" | sed 's!:\.:!:!g')

或者,重新排序目录列表,以便首先列出系统目录。在这里,我重新排序了它们,删除了重复的条目,并取出了.

代码语言:javascript
复制
PATH=/usr/local/bin:/bin:/usr/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/soft/geoeast4.0.3/opt/lightning/build/Linux.x86_64/bin:/soft/geoeast4.0.3/opt/gstomo/Linux.x86_64/bin:/soft/geoeast4.0.3/opt/diva/bin:/soft/geoeast4.0.3/opt/lightning/build/Linux.x86_64/bin:/soft/geoeast4.0.3/opt/gstomo/Linux.x86_64/bin:/soft/geoeast4.0.3/support/fontforge/bin:/soft/geoeast4.0.3/support/tools/bin:/soft/geoeast4.0.3/bin/cw:/soft/geoeast4.0.3/bin/GeoGME:/soft/geoeast4.0.3/bin/vsp:/soft/geoeast4.0.3/bin/sfp:/soft/geoeast4.0.3/bin/sdp/cshell:/soft/geoeast4.0.3/bin/sdppy:/soft/geoeast4.0.3/bin/statics:/soft/geoeast4.0.3/bin/sdp/bin:/soft/geoeast4.0.3/bin/sdp/int:/soft/geoeast4.0.3/bin/sdp:/soft/geoeast4.0.3/bin/mc:/soft/geoeast4.0.3/bin/cw:/soft/geoeast4.0.3/bin/ggi:/soft/ieco1.0.3/support/zookeeper/bin:/soft/ieco1.0.3/support/hadoop/hadoop-2.7.2/bin:/soft/ieco1.0.3/support/hadoop/hadoop-2.7.2/sbin:/soft/ieco1.0.3/install:/soft/ieco1.0.3/bin/batp:/soft/ieco1.0.3/bin/nap:/soft/ieco1.0.3/bin/ndp:/soft/ieco1.0.3/bin/ncp:/soft/ieco1.0.3/bin/ncld:/soft/ieco1.0.3/bin/common:/soft/ieco1.0.3/GeoSeisIO/bin:/soft/ieco1.0.3/ivtms/console:/soft/ieco1.0.3/licmng/bin:/soft/ieco1.0.3/support_2.6.32/tools/bin:/soft/ieco1.0.3/support_2.6.32/python/gbin:/soft/ieco1.0.3/support_2.6.32/cwp/bin:/soft/ieco1.0.3/support_2.6.32/mojoview/bin:/soft/ieco1.0.3/support_2.6.32/DDS.2011-07-15/bin:/soft/ieco1.0.3/support_2.6.32/PCG/bin:/soft/ieco1.0.3/support_2.6.32/gslib90/bin:/soft/ieco1.0.3/support_2.6.32/qcad:/soft/ieco1.0.3/support_2.6.32/qt3/bin:/soft/ieco1.0.3/support_2.6.32/ImageMagick/bin:/soft/ieco1.0.3/support_2.6.32/jdk/bin:/soft/ieco1.0.3/support_2.6.32/mysql/bin:/soft/ieco1.0.3/support_2.6.32/oiv/bin:/soft/ieco1.0.3/support_2.6.32/ora/bin:/soft/ieco1.0.3/support_2.6.32/postgresql/bin:/soft/ieco1.0.3/support_2.6.32/mvapich2.tcp/bin:/soft/ieco1.0.3/support_2.6.32/devtoolset-9_as6/root/usr/bin
票数 0
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/718533

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档