0

I am trying to determine whether or not a number of CentOS servers have SELinux enabled.

To do this, I am using the getenforce command.

When I run the command locally on a single server, it either returns Enforcing or Disabled.

When I try and run the command in the format ssh sysadmin@server.org "getenforce" it returns bash: getenforce: command not found

Is there a reason the command will work when logged on locally to the server but be unable to be found when using SSH?

Note: this only happens on servers where the command would return Enforcing. If a server has SELinux disabled it will return Disabled when running the command via SSH.

0xSheepdog
  • 2,750

1 Answers1

1

Following advice from @Kusalananda♦, I referenced the absolute path when using the command like this:

ssh sysadmin@server.org "/usr/sbin/getenforce"