ssh -o ServerAliveInterval=60 ubuntu@ip
Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts
How to set JAVA_HOME for Java permanently on Ubuntu Linux
You can set your JAVA_HOME in /etc/profile. But the preferred location for JAVA_HOME or any system variable is /etc/environment.
Open /etc/environment in any text editor like nano or gedit and add the following line:
JAVA_HOME="/usr/lib/jvm/open-jdk"
(java path could be different)
Use source to load the variables, by running this command:
source /etc/environment
Then check the variable, by running this command:
echo $JAVA_HOME
Update
Usually most linux systems source /etc/environment by default. If your system doesn't do that add the following line to ~/.bashrc
source /etc/environment
After that, run the below command to add the java_home to the path variable.
export PATH="$PATH:$JAVA_HOME/bin"
If you want it permanent, then add the above line to ~/.profile
Now, running $ java -version would return your version.
Open /etc/environment in any text editor like nano or gedit and add the following line:
JAVA_HOME="/usr/lib/jvm/open-jdk"
(java path could be different)
Use source to load the variables, by running this command:
source /etc/environment
Then check the variable, by running this command:
echo $JAVA_HOME
Update
Usually most linux systems source /etc/environment by default. If your system doesn't do that add the following line to ~/.bashrc
source /etc/environment
After that, run the below command to add the java_home to the path variable.
export PATH="$PATH:$JAVA_HOME/bin"
If you want it permanent, then add the above line to ~/.profile
Now, running $ java -version would return your version.
Install Node.js with Ubuntu Package Manager
To install Node.js, type the following command in your terminal:
1
|
sudo apt-get install nodejs
|
Then install the Node package manager, npm:
1
|
sudo apt-get install npm
|
Create a symbolic link for node, as many Node.js tools use this name to execute.
1
|
sudo ln -s /usr/bin/nodejs /usr/bin/node
|
Now we should have both the Node and npm commands working:
1
2
3
4
|
$ node -v
v0.10.25
$ npm -v
1.3.10
|
Fixing “WARNING: UNPROTECTED PRIVATE KEY FILE!” on Linux / OS X Mac
If you are getting this error then you probably reset the permissions on your hidden .ssh directory in your user folder, and your keys aren’t going to work anymore. It’s very important that these files not be writable by just anybody with a login to the box, so openssh will give you an error if you try to use them.
The full error message:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: UNPROTECTED PRIVATE KEY FILE! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Permissions 0744 for '/home/geek/.ssh/id_rsa' are too open. It is recommended that your private key files are NOT accessible by others. This private key will be ignored. bad permissions: ignore key: /home/geek/.ssh/id_rsa
To fix this, you’ll need to reset the permissions back to default:
sudo chmod 600 ~/.ssh/id_rsa sudo chmod 600 ~/.ssh/id_rsa.pub
If you are getting another error:
Are you sure you want to continue connecting (yes/no)? yes Failed to add the host to the list of known hosts (/home/geek/.ssh/known_hosts).
This means that the permissions on that file are also set incorrectly, and can be adjusted with this:
sudo chmod 644 ~/.ssh/known_hosts
Finally, you may need to adjust the directory permissions as well:
sudo chmod 755 ~/.ssh
This should get you back up and running.
Unzip a gz file and see contents even though you do not have write permission
gunzip -c <file_name.gz> | less
Subscribe to:
Posts (Atom)