Centos

-bash: yum: 通過 SSH 找不到命令

  • February 9, 2019

我正在嘗試通過 SSH 將項目部署到遠端伺服器,但我一直收到此錯誤消息,command not found無論我輸入sudoyum. 到目前為止,我已經檢查了一些文章,但仍然不知道如何解決它。

我的本地作業系統是這樣的,所以我通過在終端中Ubuntu 18.04輸入直接連接到伺服器。ssh username@hostname更多數據:

的輸出cat /etc/os-release

galtecch@s063 [/etc/yum.repos.d]# cat /etc/os-release
NAME="CloudLinux"
VERSION="7.5 (Viktor Gorbatko)"
ID="cloudlinux"
ID_LIKE="rhel fedora centos"
VERSION_ID="7.5"
PRETTY_NAME="CloudLinux 7.5 (Viktor Gorbatko)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:cloudlinux:cloudlinux:7.5:GA:server"
HOME_URL="https://www.cloudlinux.com/"
BUG_REPORT_URL="https://www.cloudlinux.com/support"

完整列表/etc

galtecch@s063 [/etc]# ls
./                       GeoIP.conf.default  mime.types       senderverifybypasshosts
../                      ghostscript/        motd             services
aliases                  group               my.cnf           shadow
aliases.db               host.conf           my.cnf.d/        skel/
alternatives/            hosts               nsswitch.conf    skipsmtpcheckhosts
at.deny                  ImageMagick/        odbcinst.ini     spammeripblocks
backupmxhosts            init.d/             openldap/        ssh/
bashrc                   inputrc             os-release       ssl/
blackfire/               issue               pam.d/           subversion/
cl.nodejs@               issue.net           passwd           sysconfig/
cloudlinux-release       ld.so.cache         pki/             system-release@
cl.php.d/                ld.so.conf          profile          system-release-cpe
cl.selector/             ld.so.conf.d/       profile.d/       trusted-key.key
cron.daily/              localtime@          protocols        trustedmailhosts
default/                 lynx.cfg            redhat-release@  vimrc
DIR_COLORS               lynx.lss            relayhosts@      virc
DIR_COLORS.256color      lynx-site.cfg       resolv.conf      wgetrc
DIR_COLORS.lightbgcolor  mail/               rpc              yum.repos.d/
domainusers              mailcap             rpm/             zlogin
environment              mailhelo            rsyncd.conf      zlogout
.etc.version             mailips             sasl2/           zprofile
fonts/                   mail.rc             scl/             zshenv
gcrypt/                  man_db.conf         screenrc         zshrc
GeoIP.conf               mc/                 security/

所以你可以看到有etc/yum.repos.d/,這是裡面的內容:

galtecch@s063 [/etc/yum.repos.d]# ls
./  ../  centos-extras.repo  cloudlinux-imunify360.repo  cloudlinux.repo

一些 yum 命令:

galtecch@s063 [/etc/yum.repos.d]# uname -r
3.10.0-714.10.2.lve1.5.19.3.el7.x86_64
galtecch@s063 [/etc/yum.repos.d]# yum
-bash: yum: command not found
galtecch@s063 [/etc/yum.repos.d]# which yum
galtecch@s063 [/etc/yum.repos.d]# echo $PATH
/usr/local/cpanel/3rdparty/lib/path-bin:/usr/local/jdk/bin:/usr/local/cpanel/3rdparty/lib/path-bin:/usr/local/cpanel/3rdparty/lib/path-bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/opt/puppetlabs/bin:/usr/local/bin:/usr/X11R6/bin:/home/galtecch/bin
galtecch@s063 [/etc/yum.repos.d]# rpm -q yum
-bash: rpm: command not found
galtecch@s063 [/etc/yum.repos.d]# find /bin/ /usr/bin -name yum
galtecch@s063 [/etc/yum.repos.d]# find /bin/ /usr/bin -name yum*
galtecch@s063 [/etc/yum.repos.d]# ls -l /etc/yum.conf
/bin/ls: cannot access /etc/yum.conf: No such file or directory

我已經聯繫了供應商,結果發現共享伺服器上不允許 root 訪問。我會嘗試想一個更簡單的方法來做到這一點。噸

引用自:https://unix.stackexchange.com/questions/499092