1

I tried to run my jar file on server with following command

java -Jar file.jar

I often get write fialed: broken pipe if my client computer go sleep and resume later.

I want to solve this problem based on this page. But, the ssh_configure file has read only permission and I cannot save the following line in it.

Host *
ServerAliveInterval 120

I want to know how can I change the context of this file.

user3487667
  • 171
  • 1
  • 2
  • 6

1 Answers1

0

You can save this in the per user ssh client configuration file ~/.ssh/config. You need to create it if it does not exist already. Now add the following:

Host *
    ServerAliveInterval 120

Change the interval if you want but don't give a high value.

The global ssh client configuration file /etc/ssh/ssh_config has the following permission:

-rw-r--r-- 1 root root 1720 Jun  8 00:23 /etc/ssh/ssh_config

As you can see you need to be root to edit the file.

heemayl
  • 90,425
  • 20
  • 200
  • 267
  • I have a ssh_config file in the address /etc/ssh but I have not a root access. Is there other way to do this change – user3487667 Jun 10 '15 at 18:17
  • @user3487667 you don't need `/etc/ssh/ssh_config`..create the file `/home/user/.ssh/config`.. replace user with your actual username..it can be made short as `~/.ssh/config` as `~` means /home/user....now follow my answer and put the mentioned lines in the file.. – heemayl Jun 10 '15 at 18:24
  • what do you mean by **.ssh** and after I create this file what should I do? – user3487667 Jun 10 '15 at 19:34
  • `~` is `/home/user`, `.ssh` is a directory under `~`, `config` is a file under `.ssh`..so the fil to modify is `~/.ssh/config` ....create the directory `~/.ssh` first (if not exist already) by `mkdir ~/.ssh` ....then create the file `touch ~/.ssh/config` .....now open the file with your favorite text editor and add the lines i have mentioned in the answer.. – heemayl Jun 10 '15 at 19:37
  • Sorry I am not familier with Ubuntu enviroment. I followed your answere but I confuse – user3487667 Jun 10 '15 at 20:01
  • Just run the command `printf 'host *\n ServerAliveInterval 120\n' >>~/.ssh/config` ....this will do..... – heemayl Jun 10 '15 at 20:03