0

System info:

Distributor ID: Ubuntu | Ubuntu 14.04.5 LTS | Release: 14.04 | Codename: trusty

Problem:

I am having trouble. I am trying to get openVPN and I am following this guide here: Link to guide.

I have successfully done the first two commands, but when I do this code:

gunzip -c /usr/share/doc/openvpn/examples/sample-config-files/server.conf.gz > /etc/openvpn/server.conf

I get an error: `bash: /etc/openvpn/server.conf: Permission Denied.

Can anybody help? Feel free to ask for additional information.

Caleb H
  • 1
  • 1
  • 1

2 Answers2

0

Try running

sudo -i

After that, try

gunzip -c 

again.

guntbert
  • 12,914
  • 37
  • 45
  • 86
0

You can't write into the /etc/ directory without using sudo. The guide omits this little fact in many cases. Notice the first command apt-get update which also won't work without sudo. I think the guide assumes you are logged in as root.

Modify the command as follows:

gunzip -c /usr/share/doc/openvpn/examples/sample-config-files/server.conf.gz | sudo tee /etc/openvpn/server.conf

b_laoshi
  • 4,570
  • 2
  • 22
  • 46
Organic Marble
  • 22,803
  • 12
  • 65
  • 118
  • I did instead of gunzip, I did sudo sh and still got the same error but I haven't done it with gunzip. Thanks, i'll try it. – Caleb H Jun 19 '17 at 00:57
  • 1
    See [When using sudo with redirection, I get 'permission denied'](https://askubuntu.com/questions/230476/when-using-sudo-with-redirection-i-get-permission-denied?) – steeldriver Jun 19 '17 at 01:00
  • The redirection (`>/etc/openvpn/server.conf`) is done while parsing the `sudo ...`, and is owned by the non-`root` user. `gunzip -c /usr/share/doc/openvpn/examples/sample-config-files/server.conf.gz | sudo tee /etc/openvpn/server.conf >/dev/null` – waltinator Jun 19 '17 at 01:33