Understand PATH

I'm new to unix so sorry for the confusing question.
I installed OPENSSL following these instructions.
Installing OpenSSH Packages - SPARC and Intel/Solaris 8

I need to run this command, "openssl req -newkey rsa:1024 -keyout server.pf.key -out req.pem" from a keyreq folder I created.

How do I add openssl to my PATH so that I can run it from anywhere?

here is the output:

# openssl req -newkey rsa:1024 -keyout server.pf.key -out req.pem
bash: openssl: command not found

thanks again.

Probably with:

PATH=$PATH:/usr/local/bin

Sunfreeware installs openssl in /usr/local/ssl/ so your PATH to the binary would be:

PATH=${PATH}:/usr/local/ssl/bin
1 Like

cool, that seems to work. thanks.

---------- Post updated at 02:45 PM ---------- Previous update was at 02:27 PM ----------

Actually what I was supposed to get was something like this:

[root@server keyreq]# openssl req -newkey rsa:1024 -keyout server.pf.key -out req.pem
Generating a 1024 bit RSA private key
..++++++
.........++++++
writing new private key to 'server.pf.key'
Enter PEM pass phrase: ENTER A PASSPHRASE
Verifying - Enter PEM pass phrase: ENTER PASSPHRASE AGAIN
-----

I got nothing, it didn't create the files or ask me anything.
I tried it again and received an error:

openssl req -newkey rsa:1024 -keyout server.pf.key -out req.pem
ld.so.1: openssl: fatal: libssl.so.0.9.7: open failed: No such file or directory
Killed

you are on solaris 8? which packages have you installed? the link you provided lists 8 packages to install. your error message looks like you don't install them...

1 Like

I'm on solaris 10, I couldn't find instructions for solaris 10 so I used the solaris 8 instructions. but used solaris 10 packages.
This is the package I actually used.

openssl-0.9.7g-sol10-intel-local.gz

from here.
Freeware List for Solaris 10 - x86

---------- Post updated at 04:53 PM ---------- Previous update was at 04:44 PM ----------

I also installed gcc-3.4.6-sol10-x86-local.gz because it said it was required.

solaris 10 has all packages on board... remove the new packages with "pkgrm" and add /usr/sfw/bin to you path and try again with the "openssl" command.

1 Like

so everything was already installed?

-bash-3.00$ pkginfo | grep openssl
system      SUNWopenssl-commands             OpenSSL Commands (Usr)
system      SUNWopenssl-include              OpenSSL Header Files
system      SUNWopenssl-libraries            OpenSSL Libraries (Usr)
system      SUNWopenssl-man                  OpenSSL Manual Pages
system      SUNWopensslr                     OpenSSL (Root)

That was it, perfect. Thanks

-bash-3.00$ PATH=${PATH}:/usr/sfw/bin
-bash-3.00$ openssl req -newkey rsa:1024 -keyout server.pf.key -out req.pem
Generating a 1024 bit RSA private key
...........................++++++
..............................................................++++++
writing new private key to 'server.pf.key'
Enter PEM pass phrase:

I'm I missing something here?

why doesn't this work:

bash-3.00# ls |grep openssl
openssl
bash-3.00# openssl req -newkey rsa:2048-keyout server.pf.key -out req.pem
bash: openssl: command not found

is it because it's a solaris zone?

try ./openssl req .... in the same directory as above.

1 Like

No, it is because the directory where the command is located is missing from your PATH. Either use an explicit path as already suggested by DukeNuke2, or add the directory to your PATH. Note that adding "." to your PATH will work but is a bad practice, especially as you seem to run this as root.

1 Like

It was a path issue, thanks.

I updated path using:

PATH=$PATH:$HOME/bin:/sbin
PATH=$PATH:$HOME/bin
PATH=$PATH:$HOME/bin:/usr/sfw/bin

It seems like each time I connect I lose my path, is there anyway to keep it?

read the man page of the shell you are using. there should be hints about config files to use for just this...

1 Like

Looks redundant. Simply use:

PATH=$PATH:/sbin:$HOME/bin:/usr/sfw/bin
1 Like