apf: command not found

Okay, if you’re getting this error, you’re getting it for one of two reasons.

Advanced Policy Firewall (APF) Is Not Installed

Type in the following command:

$ /etc/apf/apf

One of two things will happen..

You’ll this error message:

/etc/apf/apf: No such file or directory

OR

You’ll get something like this:

$ /etc/apf/apf
APF version 9.6 <apf@r-fx.org>

If you get the first expected result, APF isn’t installed. Go to Advanced Policy Firewall project page, download it and install.

Bash “PATH” Variable

If when performing the above test got something like this:

$ /etc/apf/apf
APF version 9.6 <apf@r-fx.org>

It is likely your environmental “PATH” variable doesn’t cover /usr/local/sbin/ or similar. When APF is installed, it symlinks /usr/local/sbin/apf to /etc/apf/apf. To check, try the following command and see if /usr/local/sbin/ is included:

$ echo $PATH
/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/root/bin

You can either type your commands like “/etc/apf/apf -d <source>” or you can fix the symbolic link (probably the better idea because other links may be broken).

To fix the PATH variable to include the new bin, modify your bash profile or server-wide (either ~/.bash_profile or /etc/bashrc respectively – the first is probably safer):

vi ~/.bash_profile

Again, I use vi/vim, use nano or your other preferred editor if that’s what you prefer.

Look for a variable like this:

PATH=$PATH:$HOME/bin:/usr/bin/systools

To the end, add something like:

:/usr/local/sbin

Resulting in it now looking like:

PATH=$PATH:$HOME/bin:/usr/bin/systools:/usr/local/sbin

Then I recommend you just logout and then login again. You stuff around with export, but easier to just logout/in again.

Didn’t Work?

There are a number of other possible solutions depending on the problem you’re experiencing. I’ve only covered two. Leave a comment with some output of your tests and we’ll take a look.

Similar Posts:

VN:F [1.9.22_1171]
Rating: 2.0/5 (1 vote cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)
apf: command not found, 2.0 out of 5 based on 1 rating
This entry was posted in Server Administration. Bookmark the permalink.

What are your thoughts?