How do I use a credential file for CIFS in /etc/fstab?
I’m having a problem with fstab on Server 18.04. I’m trying to mount a number of Windows Server network shares. If I put the username and password into each line of fstab and do sudo mount -a, it works fine. However, when I try to use a “credentials” file, it all goes pear-shaped.
So this:
//server/share /mount/point cifs ro,auto,user=user,password=password 0 0
…works fine.
However, if I try this:
//server/share /mount/point cifs ro,auto,credentials=/etc/.smbcredentials 0 0
…with .smbcredentials containing the following:
user=username
password=password
domain=domain
…this does not work. sudo mount -a -v outputs the following:
/ : ignored
/boot/efi : already mounted
none : ignored
domain=mydomain
,prefixpath=Projects/XYZ,pass=********.168.1.10,unc=servershare,user=username
mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
168.1.10 is the partial IP address of the server on which the shares that I want to mount are located. It appears that the password is being concatenated onto the IP of the server.
So, what am I doing wrong? Any help would be much appreciated.
fstab cifs
|
show 4 more comments
I’m having a problem with fstab on Server 18.04. I’m trying to mount a number of Windows Server network shares. If I put the username and password into each line of fstab and do sudo mount -a, it works fine. However, when I try to use a “credentials” file, it all goes pear-shaped.
So this:
//server/share /mount/point cifs ro,auto,user=user,password=password 0 0
…works fine.
However, if I try this:
//server/share /mount/point cifs ro,auto,credentials=/etc/.smbcredentials 0 0
…with .smbcredentials containing the following:
user=username
password=password
domain=domain
…this does not work. sudo mount -a -v outputs the following:
/ : ignored
/boot/efi : already mounted
none : ignored
domain=mydomain
,prefixpath=Projects/XYZ,pass=********.168.1.10,unc=servershare,user=username
mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
168.1.10 is the partial IP address of the server on which the shares that I want to mount are located. It appears that the password is being concatenated onto the IP of the server.
So, what am I doing wrong? Any help would be much appreciated.
fstab cifs
Hi welcome to Ask Ubuntu! The credentials file is supposed to useusername=usernamerather thanuser=..though I can't see how that would cause this problem. Was that just a typo in the post?
– Arronical
Feb 20 at 11:29
Hi, I've seen examples that use either user or username. I'm not sure if you can use either or only one or the other. Paul
– threnody
Feb 20 at 11:33
Yeah, I've just tried it on a 14.04 server and you're correct. Either of them work. I'm afraid I don't have anything else to offer, hopefully someone more knowledgeable will be along to help.
– Arronical
Feb 20 at 11:41
2
A related post on Unix SE: unix.stackexchange.com/questions/124342/… It mentions debugging the issue in dmesg and syslog. It might be due to the defaultsecbeing selected when using credentials.
– Dan
Feb 20 at 11:57
1
Does your credentials file have the correct (Unix-style) line terminations? or does it use Windows style CRLF?
– steeldriver
Feb 20 at 12:28
|
show 4 more comments
I’m having a problem with fstab on Server 18.04. I’m trying to mount a number of Windows Server network shares. If I put the username and password into each line of fstab and do sudo mount -a, it works fine. However, when I try to use a “credentials” file, it all goes pear-shaped.
So this:
//server/share /mount/point cifs ro,auto,user=user,password=password 0 0
…works fine.
However, if I try this:
//server/share /mount/point cifs ro,auto,credentials=/etc/.smbcredentials 0 0
…with .smbcredentials containing the following:
user=username
password=password
domain=domain
…this does not work. sudo mount -a -v outputs the following:
/ : ignored
/boot/efi : already mounted
none : ignored
domain=mydomain
,prefixpath=Projects/XYZ,pass=********.168.1.10,unc=servershare,user=username
mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
168.1.10 is the partial IP address of the server on which the shares that I want to mount are located. It appears that the password is being concatenated onto the IP of the server.
So, what am I doing wrong? Any help would be much appreciated.
fstab cifs
I’m having a problem with fstab on Server 18.04. I’m trying to mount a number of Windows Server network shares. If I put the username and password into each line of fstab and do sudo mount -a, it works fine. However, when I try to use a “credentials” file, it all goes pear-shaped.
So this:
//server/share /mount/point cifs ro,auto,user=user,password=password 0 0
…works fine.
However, if I try this:
//server/share /mount/point cifs ro,auto,credentials=/etc/.smbcredentials 0 0
…with .smbcredentials containing the following:
user=username
password=password
domain=domain
…this does not work. sudo mount -a -v outputs the following:
/ : ignored
/boot/efi : already mounted
none : ignored
domain=mydomain
,prefixpath=Projects/XYZ,pass=********.168.1.10,unc=servershare,user=username
mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
168.1.10 is the partial IP address of the server on which the shares that I want to mount are located. It appears that the password is being concatenated onto the IP of the server.
So, what am I doing wrong? Any help would be much appreciated.
fstab cifs
fstab cifs
edited Feb 20 at 17:58
Community♦
1
1
asked Feb 20 at 11:23
threnodythrenody
161
161
Hi welcome to Ask Ubuntu! The credentials file is supposed to useusername=usernamerather thanuser=..though I can't see how that would cause this problem. Was that just a typo in the post?
– Arronical
Feb 20 at 11:29
Hi, I've seen examples that use either user or username. I'm not sure if you can use either or only one or the other. Paul
– threnody
Feb 20 at 11:33
Yeah, I've just tried it on a 14.04 server and you're correct. Either of them work. I'm afraid I don't have anything else to offer, hopefully someone more knowledgeable will be along to help.
– Arronical
Feb 20 at 11:41
2
A related post on Unix SE: unix.stackexchange.com/questions/124342/… It mentions debugging the issue in dmesg and syslog. It might be due to the defaultsecbeing selected when using credentials.
– Dan
Feb 20 at 11:57
1
Does your credentials file have the correct (Unix-style) line terminations? or does it use Windows style CRLF?
– steeldriver
Feb 20 at 12:28
|
show 4 more comments
Hi welcome to Ask Ubuntu! The credentials file is supposed to useusername=usernamerather thanuser=..though I can't see how that would cause this problem. Was that just a typo in the post?
– Arronical
Feb 20 at 11:29
Hi, I've seen examples that use either user or username. I'm not sure if you can use either or only one or the other. Paul
– threnody
Feb 20 at 11:33
Yeah, I've just tried it on a 14.04 server and you're correct. Either of them work. I'm afraid I don't have anything else to offer, hopefully someone more knowledgeable will be along to help.
– Arronical
Feb 20 at 11:41
2
A related post on Unix SE: unix.stackexchange.com/questions/124342/… It mentions debugging the issue in dmesg and syslog. It might be due to the defaultsecbeing selected when using credentials.
– Dan
Feb 20 at 11:57
1
Does your credentials file have the correct (Unix-style) line terminations? or does it use Windows style CRLF?
– steeldriver
Feb 20 at 12:28
Hi welcome to Ask Ubuntu! The credentials file is supposed to use
username=username rather than user=.. though I can't see how that would cause this problem. Was that just a typo in the post?– Arronical
Feb 20 at 11:29
Hi welcome to Ask Ubuntu! The credentials file is supposed to use
username=username rather than user=.. though I can't see how that would cause this problem. Was that just a typo in the post?– Arronical
Feb 20 at 11:29
Hi, I've seen examples that use either user or username. I'm not sure if you can use either or only one or the other. Paul
– threnody
Feb 20 at 11:33
Hi, I've seen examples that use either user or username. I'm not sure if you can use either or only one or the other. Paul
– threnody
Feb 20 at 11:33
Yeah, I've just tried it on a 14.04 server and you're correct. Either of them work. I'm afraid I don't have anything else to offer, hopefully someone more knowledgeable will be along to help.
– Arronical
Feb 20 at 11:41
Yeah, I've just tried it on a 14.04 server and you're correct. Either of them work. I'm afraid I don't have anything else to offer, hopefully someone more knowledgeable will be along to help.
– Arronical
Feb 20 at 11:41
2
2
A related post on Unix SE: unix.stackexchange.com/questions/124342/… It mentions debugging the issue in dmesg and syslog. It might be due to the default
sec being selected when using credentials.– Dan
Feb 20 at 11:57
A related post on Unix SE: unix.stackexchange.com/questions/124342/… It mentions debugging the issue in dmesg and syslog. It might be due to the default
sec being selected when using credentials.– Dan
Feb 20 at 11:57
1
1
Does your credentials file have the correct (Unix-style) line terminations? or does it use Windows style CRLF?
– steeldriver
Feb 20 at 12:28
Does your credentials file have the correct (Unix-style) line terminations? or does it use Windows style CRLF?
– steeldriver
Feb 20 at 12:28
|
show 4 more comments
1 Answer
1
active
oldest
votes
My working credentials file is located in my ~ folder and looks like this
username=[username]
password=[password]
Its permissions are -rw------- and it is owned by my user.
The corresponding fstab line is
//[URL]/[sharename] /media/[mountpoint] cifs vers=3.0,credentials=/home/[username]/.sharelogin,iocharset=utf8,file_mode=0777,dir_mode=0777,uid=[username],gid=[username],nofail 0 0
I don't use "domain" but that doesn't mean that you don't need it.
Hi, I tried your suggested version - still can't get it to work with a credentials file. Thanks anyway!
– threnody
Feb 22 at 14:31
Are you supplying the correct credentials? It works fine for me.
– Organic Marble
Feb 22 at 14:33
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%2f1119819%2fhow-do-i-use-a-credential-file-for-cifs-in-etc-fstab%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
My working credentials file is located in my ~ folder and looks like this
username=[username]
password=[password]
Its permissions are -rw------- and it is owned by my user.
The corresponding fstab line is
//[URL]/[sharename] /media/[mountpoint] cifs vers=3.0,credentials=/home/[username]/.sharelogin,iocharset=utf8,file_mode=0777,dir_mode=0777,uid=[username],gid=[username],nofail 0 0
I don't use "domain" but that doesn't mean that you don't need it.
Hi, I tried your suggested version - still can't get it to work with a credentials file. Thanks anyway!
– threnody
Feb 22 at 14:31
Are you supplying the correct credentials? It works fine for me.
– Organic Marble
Feb 22 at 14:33
add a comment |
My working credentials file is located in my ~ folder and looks like this
username=[username]
password=[password]
Its permissions are -rw------- and it is owned by my user.
The corresponding fstab line is
//[URL]/[sharename] /media/[mountpoint] cifs vers=3.0,credentials=/home/[username]/.sharelogin,iocharset=utf8,file_mode=0777,dir_mode=0777,uid=[username],gid=[username],nofail 0 0
I don't use "domain" but that doesn't mean that you don't need it.
Hi, I tried your suggested version - still can't get it to work with a credentials file. Thanks anyway!
– threnody
Feb 22 at 14:31
Are you supplying the correct credentials? It works fine for me.
– Organic Marble
Feb 22 at 14:33
add a comment |
My working credentials file is located in my ~ folder and looks like this
username=[username]
password=[password]
Its permissions are -rw------- and it is owned by my user.
The corresponding fstab line is
//[URL]/[sharename] /media/[mountpoint] cifs vers=3.0,credentials=/home/[username]/.sharelogin,iocharset=utf8,file_mode=0777,dir_mode=0777,uid=[username],gid=[username],nofail 0 0
I don't use "domain" but that doesn't mean that you don't need it.
My working credentials file is located in my ~ folder and looks like this
username=[username]
password=[password]
Its permissions are -rw------- and it is owned by my user.
The corresponding fstab line is
//[URL]/[sharename] /media/[mountpoint] cifs vers=3.0,credentials=/home/[username]/.sharelogin,iocharset=utf8,file_mode=0777,dir_mode=0777,uid=[username],gid=[username],nofail 0 0
I don't use "domain" but that doesn't mean that you don't need it.
edited Feb 20 at 20:35
answered Feb 20 at 18:03
Organic MarbleOrganic Marble
11.5k63459
11.5k63459
Hi, I tried your suggested version - still can't get it to work with a credentials file. Thanks anyway!
– threnody
Feb 22 at 14:31
Are you supplying the correct credentials? It works fine for me.
– Organic Marble
Feb 22 at 14:33
add a comment |
Hi, I tried your suggested version - still can't get it to work with a credentials file. Thanks anyway!
– threnody
Feb 22 at 14:31
Are you supplying the correct credentials? It works fine for me.
– Organic Marble
Feb 22 at 14:33
Hi, I tried your suggested version - still can't get it to work with a credentials file. Thanks anyway!
– threnody
Feb 22 at 14:31
Hi, I tried your suggested version - still can't get it to work with a credentials file. Thanks anyway!
– threnody
Feb 22 at 14:31
Are you supplying the correct credentials? It works fine for me.
– Organic Marble
Feb 22 at 14:33
Are you supplying the correct credentials? It works fine for me.
– Organic Marble
Feb 22 at 14:33
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%2f1119819%2fhow-do-i-use-a-credential-file-for-cifs-in-etc-fstab%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
Hi welcome to Ask Ubuntu! The credentials file is supposed to use
username=usernamerather thanuser=..though I can't see how that would cause this problem. Was that just a typo in the post?– Arronical
Feb 20 at 11:29
Hi, I've seen examples that use either user or username. I'm not sure if you can use either or only one or the other. Paul
– threnody
Feb 20 at 11:33
Yeah, I've just tried it on a 14.04 server and you're correct. Either of them work. I'm afraid I don't have anything else to offer, hopefully someone more knowledgeable will be along to help.
– Arronical
Feb 20 at 11:41
2
A related post on Unix SE: unix.stackexchange.com/questions/124342/… It mentions debugging the issue in dmesg and syslog. It might be due to the default
secbeing selected when using credentials.– Dan
Feb 20 at 11:57
1
Does your credentials file have the correct (Unix-style) line terminations? or does it use Windows style CRLF?
– steeldriver
Feb 20 at 12:28