resolv.conf permissions/ownership change after VPN disconnect
I recently installed Ubuntu 18.04. I set up a VPN through the standard Settings->Network GUI. I can connect to the VPN with no problems, but when I disconnect the VPN I cannot access the internet through my web browser. I can, however, ping an internet address from a shell window.
My /etc/resolv.conf file is a symlink to /run/systemd/resolve/stub-resolv.conf.
Before I connect to the VPN, the permissions/ownership are as follows:
-rw-r--r-- 1 systemd-resolve systemd-resolve 701 Jun 20 20:28 /run/systemd/resolve/stub-resolv.conf
While I am connected to the VPN these permissions stay the same, but when I disconnect, the read permissions are dropped and the ownership changes to root:root
, like this:
-rw------- 1 root root 701 Jun 20 20:31 /run/systemd/resolve/stub-resolv.conf
It seems that because of this, my web browser cannot read the resolv.conf file and thus does not know what nameserver to use
If I chmod a+r
this file, I can access the internet fine, even though the ownership is still root:root
.
Does anyone have any idea what is happening here and how it could be fixed without manually changing permissions of the resolv file every time I disconnect the VPN?
networking permissions network-manager vpn
add a comment |
I recently installed Ubuntu 18.04. I set up a VPN through the standard Settings->Network GUI. I can connect to the VPN with no problems, but when I disconnect the VPN I cannot access the internet through my web browser. I can, however, ping an internet address from a shell window.
My /etc/resolv.conf file is a symlink to /run/systemd/resolve/stub-resolv.conf.
Before I connect to the VPN, the permissions/ownership are as follows:
-rw-r--r-- 1 systemd-resolve systemd-resolve 701 Jun 20 20:28 /run/systemd/resolve/stub-resolv.conf
While I am connected to the VPN these permissions stay the same, but when I disconnect, the read permissions are dropped and the ownership changes to root:root
, like this:
-rw------- 1 root root 701 Jun 20 20:31 /run/systemd/resolve/stub-resolv.conf
It seems that because of this, my web browser cannot read the resolv.conf file and thus does not know what nameserver to use
If I chmod a+r
this file, I can access the internet fine, even though the ownership is still root:root
.
Does anyone have any idea what is happening here and how it could be fixed without manually changing permissions of the resolv file every time I disconnect the VPN?
networking permissions network-manager vpn
The VPN modifies resolv.conf with the DNS server address from the VPN provider, and then changes it back when disconnected. You may have added an incorrect OpenVPN command to your VPN script file.
– heynnema
Jun 21 '18 at 13:37
add a comment |
I recently installed Ubuntu 18.04. I set up a VPN through the standard Settings->Network GUI. I can connect to the VPN with no problems, but when I disconnect the VPN I cannot access the internet through my web browser. I can, however, ping an internet address from a shell window.
My /etc/resolv.conf file is a symlink to /run/systemd/resolve/stub-resolv.conf.
Before I connect to the VPN, the permissions/ownership are as follows:
-rw-r--r-- 1 systemd-resolve systemd-resolve 701 Jun 20 20:28 /run/systemd/resolve/stub-resolv.conf
While I am connected to the VPN these permissions stay the same, but when I disconnect, the read permissions are dropped and the ownership changes to root:root
, like this:
-rw------- 1 root root 701 Jun 20 20:31 /run/systemd/resolve/stub-resolv.conf
It seems that because of this, my web browser cannot read the resolv.conf file and thus does not know what nameserver to use
If I chmod a+r
this file, I can access the internet fine, even though the ownership is still root:root
.
Does anyone have any idea what is happening here and how it could be fixed without manually changing permissions of the resolv file every time I disconnect the VPN?
networking permissions network-manager vpn
I recently installed Ubuntu 18.04. I set up a VPN through the standard Settings->Network GUI. I can connect to the VPN with no problems, but when I disconnect the VPN I cannot access the internet through my web browser. I can, however, ping an internet address from a shell window.
My /etc/resolv.conf file is a symlink to /run/systemd/resolve/stub-resolv.conf.
Before I connect to the VPN, the permissions/ownership are as follows:
-rw-r--r-- 1 systemd-resolve systemd-resolve 701 Jun 20 20:28 /run/systemd/resolve/stub-resolv.conf
While I am connected to the VPN these permissions stay the same, but when I disconnect, the read permissions are dropped and the ownership changes to root:root
, like this:
-rw------- 1 root root 701 Jun 20 20:31 /run/systemd/resolve/stub-resolv.conf
It seems that because of this, my web browser cannot read the resolv.conf file and thus does not know what nameserver to use
If I chmod a+r
this file, I can access the internet fine, even though the ownership is still root:root
.
Does anyone have any idea what is happening here and how it could be fixed without manually changing permissions of the resolv file every time I disconnect the VPN?
networking permissions network-manager vpn
networking permissions network-manager vpn
edited Jun 21 '18 at 2:13
Stephen Rauch
1,1546716
1,1546716
asked Jun 21 '18 at 1:56
ds1848ds1848
11
11
The VPN modifies resolv.conf with the DNS server address from the VPN provider, and then changes it back when disconnected. You may have added an incorrect OpenVPN command to your VPN script file.
– heynnema
Jun 21 '18 at 13:37
add a comment |
The VPN modifies resolv.conf with the DNS server address from the VPN provider, and then changes it back when disconnected. You may have added an incorrect OpenVPN command to your VPN script file.
– heynnema
Jun 21 '18 at 13:37
The VPN modifies resolv.conf with the DNS server address from the VPN provider, and then changes it back when disconnected. You may have added an incorrect OpenVPN command to your VPN script file.
– heynnema
Jun 21 '18 at 13:37
The VPN modifies resolv.conf with the DNS server address from the VPN provider, and then changes it back when disconnected. You may have added an incorrect OpenVPN command to your VPN script file.
– heynnema
Jun 21 '18 at 13:37
add a comment |
3 Answers
3
active
oldest
votes
Update: I added a script in the /etc/network/if-post-down.d directory that just changes the permissions/ownership of the stub-resolv.conf file when the VPN disconnects.
if [ "$IFACE" = ppp0 ]; then
chmod a+r /run/systemd/resolve/stub-resolv.conf
chown systemd-resolve:systemd-resolve /run/systemd/resolve/stub-resolv.conf
fi
That seems to work for now.
add a comment |
I have the same issue. Maybe it is a bug.
But I use NetworkManager. This solution does not work with it. The script does not run. I add my solution for it.
The NetworkManager has similar solution.
The script must be added to the directory:
/etc/NetworkManager/dispatcher.d
I have added this file: "02-fix-resolv.conf.sh":
#!/bin/sh
if [ "$1" = "ppp0" -a "$2" = "vpn-up" ]; then
echo "bleeeeeee je dole" > /tmp/testjenahore.txt
chmod a+r /run/systemd/resolve/stub-resolv.conf.pppd-backup.ppp0
chown systemd-resolve:systemd-resolve /run/systemd/resolve/stub-resolv.conf.pppd-backup.ppp0
fi
It works for me.
And I finded out, that the file "/run/systemd/resolve/stub-resolv.conf.pppd-backup.ppp0" has permission and owner badly.
And my script fix permission and awner, when the VPN goes UP.
Then it works too if the VPN goes DOWN.
add a comment |
A possible fix for some, seems to be to install the following:
sudo apt install resolvconf
See :
- https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/1778946
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1048392%2fresolv-conf-permissions-ownership-change-after-vpn-disconnect%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Update: I added a script in the /etc/network/if-post-down.d directory that just changes the permissions/ownership of the stub-resolv.conf file when the VPN disconnects.
if [ "$IFACE" = ppp0 ]; then
chmod a+r /run/systemd/resolve/stub-resolv.conf
chown systemd-resolve:systemd-resolve /run/systemd/resolve/stub-resolv.conf
fi
That seems to work for now.
add a comment |
Update: I added a script in the /etc/network/if-post-down.d directory that just changes the permissions/ownership of the stub-resolv.conf file when the VPN disconnects.
if [ "$IFACE" = ppp0 ]; then
chmod a+r /run/systemd/resolve/stub-resolv.conf
chown systemd-resolve:systemd-resolve /run/systemd/resolve/stub-resolv.conf
fi
That seems to work for now.
add a comment |
Update: I added a script in the /etc/network/if-post-down.d directory that just changes the permissions/ownership of the stub-resolv.conf file when the VPN disconnects.
if [ "$IFACE" = ppp0 ]; then
chmod a+r /run/systemd/resolve/stub-resolv.conf
chown systemd-resolve:systemd-resolve /run/systemd/resolve/stub-resolv.conf
fi
That seems to work for now.
Update: I added a script in the /etc/network/if-post-down.d directory that just changes the permissions/ownership of the stub-resolv.conf file when the VPN disconnects.
if [ "$IFACE" = ppp0 ]; then
chmod a+r /run/systemd/resolve/stub-resolv.conf
chown systemd-resolve:systemd-resolve /run/systemd/resolve/stub-resolv.conf
fi
That seems to work for now.
answered Jun 21 '18 at 19:56
ds1848ds1848
11
11
add a comment |
add a comment |
I have the same issue. Maybe it is a bug.
But I use NetworkManager. This solution does not work with it. The script does not run. I add my solution for it.
The NetworkManager has similar solution.
The script must be added to the directory:
/etc/NetworkManager/dispatcher.d
I have added this file: "02-fix-resolv.conf.sh":
#!/bin/sh
if [ "$1" = "ppp0" -a "$2" = "vpn-up" ]; then
echo "bleeeeeee je dole" > /tmp/testjenahore.txt
chmod a+r /run/systemd/resolve/stub-resolv.conf.pppd-backup.ppp0
chown systemd-resolve:systemd-resolve /run/systemd/resolve/stub-resolv.conf.pppd-backup.ppp0
fi
It works for me.
And I finded out, that the file "/run/systemd/resolve/stub-resolv.conf.pppd-backup.ppp0" has permission and owner badly.
And my script fix permission and awner, when the VPN goes UP.
Then it works too if the VPN goes DOWN.
add a comment |
I have the same issue. Maybe it is a bug.
But I use NetworkManager. This solution does not work with it. The script does not run. I add my solution for it.
The NetworkManager has similar solution.
The script must be added to the directory:
/etc/NetworkManager/dispatcher.d
I have added this file: "02-fix-resolv.conf.sh":
#!/bin/sh
if [ "$1" = "ppp0" -a "$2" = "vpn-up" ]; then
echo "bleeeeeee je dole" > /tmp/testjenahore.txt
chmod a+r /run/systemd/resolve/stub-resolv.conf.pppd-backup.ppp0
chown systemd-resolve:systemd-resolve /run/systemd/resolve/stub-resolv.conf.pppd-backup.ppp0
fi
It works for me.
And I finded out, that the file "/run/systemd/resolve/stub-resolv.conf.pppd-backup.ppp0" has permission and owner badly.
And my script fix permission and awner, when the VPN goes UP.
Then it works too if the VPN goes DOWN.
add a comment |
I have the same issue. Maybe it is a bug.
But I use NetworkManager. This solution does not work with it. The script does not run. I add my solution for it.
The NetworkManager has similar solution.
The script must be added to the directory:
/etc/NetworkManager/dispatcher.d
I have added this file: "02-fix-resolv.conf.sh":
#!/bin/sh
if [ "$1" = "ppp0" -a "$2" = "vpn-up" ]; then
echo "bleeeeeee je dole" > /tmp/testjenahore.txt
chmod a+r /run/systemd/resolve/stub-resolv.conf.pppd-backup.ppp0
chown systemd-resolve:systemd-resolve /run/systemd/resolve/stub-resolv.conf.pppd-backup.ppp0
fi
It works for me.
And I finded out, that the file "/run/systemd/resolve/stub-resolv.conf.pppd-backup.ppp0" has permission and owner badly.
And my script fix permission and awner, when the VPN goes UP.
Then it works too if the VPN goes DOWN.
I have the same issue. Maybe it is a bug.
But I use NetworkManager. This solution does not work with it. The script does not run. I add my solution for it.
The NetworkManager has similar solution.
The script must be added to the directory:
/etc/NetworkManager/dispatcher.d
I have added this file: "02-fix-resolv.conf.sh":
#!/bin/sh
if [ "$1" = "ppp0" -a "$2" = "vpn-up" ]; then
echo "bleeeeeee je dole" > /tmp/testjenahore.txt
chmod a+r /run/systemd/resolve/stub-resolv.conf.pppd-backup.ppp0
chown systemd-resolve:systemd-resolve /run/systemd/resolve/stub-resolv.conf.pppd-backup.ppp0
fi
It works for me.
And I finded out, that the file "/run/systemd/resolve/stub-resolv.conf.pppd-backup.ppp0" has permission and owner badly.
And my script fix permission and awner, when the VPN goes UP.
Then it works too if the VPN goes DOWN.
answered Jul 1 '18 at 17:43
RadekRadek
1
1
add a comment |
add a comment |
A possible fix for some, seems to be to install the following:
sudo apt install resolvconf
See :
- https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/1778946
add a comment |
A possible fix for some, seems to be to install the following:
sudo apt install resolvconf
See :
- https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/1778946
add a comment |
A possible fix for some, seems to be to install the following:
sudo apt install resolvconf
See :
- https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/1778946
A possible fix for some, seems to be to install the following:
sudo apt install resolvconf
See :
- https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/1778946
edited 7 hours ago
answered 10 hours ago
Douglas KosovicDouglas Kosovic
33614
33614
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1048392%2fresolv-conf-permissions-ownership-change-after-vpn-disconnect%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
The VPN modifies resolv.conf with the DNS server address from the VPN provider, and then changes it back when disconnected. You may have added an incorrect OpenVPN command to your VPN script file.
– heynnema
Jun 21 '18 at 13:37