LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 06-25-2022, 09:06 AM   #1
krakanut
Member
 
Registered: Aug 2012
Distribution: The Slackware
Posts: 62

Rep: Reputation: Disabled
smb access to windows domain


Hi - I am trying to use smb to access my work server from linux. I can create the share and get read access but am having issues with the write/modify access. I can save or create a new file but I can not modify. I am creating the share using my windows AD credentials (user name, domain and pw) which works fine. Are there parameters within smb mount that allow me to access these network drives and files using the AD user account or will I always be using my linux user for access as this is where the mount is created from. It is a work network server so I really do not want to mess around with permissions on the AD side but would consider possibly if that was the only route.

I did try setting up the smb mount using my linux user gid and uid but that did not seem to work either.

So I guess my question is where is the write/modify security set - in the smb mount command and if so what parameters should I be using or at the AD level in which case what would need to be done there.

Any direction would be appreciated.
 
Old 06-25-2022, 10:26 AM   #2
henca
Member
 
Registered: Aug 2007
Location: Linköping, Sweden
Distribution: Slackware
Posts: 953

Rep: Reputation: 648Reputation: 648Reputation: 648Reputation: 648Reputation: 648Reputation: 648
Did you try something like this as root:

Code:
mount -t cifs //windows.server.in.net/my_win_username /mnt/win -o rw,username=my_win_username
?

regards Henrik
 
1 members found this post helpful.
Old 06-25-2022, 08:27 PM   #3
rkelsen
Senior Member
 
Registered: Sep 2004
Distribution: slackware
Posts: 4,442
Blog Entries: 7

Rep: Reputation: 2551Reputation: 2551Reputation: 2551Reputation: 2551Reputation: 2551Reputation: 2551Reputation: 2551Reputation: 2551Reputation: 2551Reputation: 2551Reputation: 2551
Quote:
Originally Posted by krakanut View Post
Are there parameters within smb mount that allow me to access these network drives and files using the AD user account or will I always be using my linux user for access as this is where the mount is created from.
Generally speaking, whenever you try to access a service, you need to use the credentials attached to that service.

On your Linux machine, you would need to use your Windows credentials to mount the Windows share. The capabilities of Linux will be limited to your user's permissions in Windows.

The way I'd do this for an ad-hoc connection is as per the instructions given by Henrik above, but slightly modified (as root):

Code:
# mount -t cifs -o username=MYUSERNAME,password=MYPASSWORD //192.168.x.x/FILESHARE_NAME /mnt/MOUNTPOINT
Note that the options (the part after "-o") are comma separated with no spaces. You could add ",ro" to the options if you want read-only access to the share.

RW access will depend upon your permissions in Windows.

If you wanted to make it happen automatically on boot (provided the machines are on the same LAN), you can add a line like the following to /etc/fstab:

Code:
//192.168.x.x/FILESHARE  /mnt/MOUNTPOINT  cifs  defaults,users,credentials=/root/win_credentials.txt  0   0
Where the file /root/win_credentials.txt is a simple text file containing your Windows credentials, like this:

Code:
username=MYUSERNAME
password=MYPASSWORD
You can also do this over the internet if you have VPN access to the office.

Last edited by rkelsen; 06-25-2022 at 08:28 PM.
 
Old 06-27-2022, 05:57 PM   #4
krakanut
Member
 
Registered: Aug 2012
Distribution: The Slackware
Posts: 62

Original Poster
Rep: Reputation: Disabled
Hi - my mount seems to be working ok - it seems to be a file rights issue. When I try to modify from Linux side (even though mounted using my AD creds) it prevents me from making any changes to a file. Even as root - trying to change a file using vi I get error Error: test1: Permission denied; test1: WARNING: FILE TRUNCATED and a {file}.part is created and both the original {file} and {file}.part are corrupt and unreadable. I can create a new file but can not modify once created.

These are all examples of file on the hare after I created the test# file and then try modifying using vi. Both the original and .part file are corrupt/unreadable after I attempt to save changes in vi.

-rwxr-xr-x 1 root root 0 Jun 27 17:53 test1
-rwxr-xr-x 1 root root 373 Jun 26 15:16 test1.part
-rwxr-xr-x 1 root root 0 Jun 26 15:18 test2
-rwxr-xr-x 1 root root 7 Jun 26 15:17 test2.part
-rwxr-xr-x 1 root root 2 Jun 26 15:25 test3
-rwxr-xr-x 1 root root 7 Jun 26 15:30 test3.part
 
Old 06-27-2022, 06:36 PM   #5
rkelsen
Senior Member
 
Registered: Sep 2004
Distribution: slackware
Posts: 4,442
Blog Entries: 7

Rep: Reputation: 2551Reputation: 2551Reputation: 2551Reputation: 2551Reputation: 2551Reputation: 2551Reputation: 2551Reputation: 2551Reputation: 2551Reputation: 2551Reputation: 2551
The problem you're having is related to permissions.

See this thread for answers: https://unix.stackexchange.com/quest...ions-and-chown
 
Old 06-28-2022, 06:22 PM   #6
krakanut
Member
 
Registered: Aug 2012
Distribution: The Slackware
Posts: 62

Original Poster
Rep: Reputation: Disabled
Thank you for sharing that link. I have tried all the iterations and though I can create the mount and see the mounted drive - I am unable to modify files. If I use my windows machine to access the same thing I type \\server\share into the file browser where it then asks me for my network credentials. Everything I do then on the server is logged as that AD user even though my windows laptop is not on the domain and is not using a domain user. The only domain creds are when I access the server. I am thinking this is the same concept that I am trying to do from my linux machine but the rights issue is still problem.

To add some details the server I am connecting to is windows server 2019; my laptop is Slackware 15 (not current)

Last edited by krakanut; 06-28-2022 at 06:31 PM.
 
Old 06-28-2022, 09:55 PM   #7
rkelsen
Senior Member
 
Registered: Sep 2004
Distribution: slackware
Posts: 4,442
Blog Entries: 7

Rep: Reputation: 2551Reputation: 2551Reputation: 2551Reputation: 2551Reputation: 2551Reputation: 2551Reputation: 2551Reputation: 2551Reputation: 2551Reputation: 2551Reputation: 2551
Let's try a different approach.

What happens if you open Konqueror and type: smb://192.168.x.x/SHARENAME into the address bar?
 
Old 06-29-2022, 11:41 AM   #8
kjhambrick
Senior Member
 
Registered: Jul 2005
Location: Round Rock, TX
Distribution: Slackware64 15.0 + Multilib
Posts: 2,159

Rep: Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512
krakanut --

What is the exact mount command you're using and 'who' is running the command ?

From the looks of things in post #4, root is running the command and there are no uid= nor gid= options ?

Do you need to add -o '... forceuid,uid=krakanut,forcegid,gid=users, ...' ?

HTH

-- kjh
 
Old 06-30-2022, 07:05 AM   #9
lukameen
Member
 
Registered: May 2004
Distribution: Slackware
Posts: 69

Rep: Reputation: 31
Have you created a .smbcredentials file in your home directory?

I mount my windows shares (using CIFS) to servers in an AD domain to a directory, home/network. I also have my .smbcredentials file stored in that network directory. The .smbcredentials file is very simple. It contains:

username=yourADusernsame
password=yourADpassword
domain=yourADdomainName

This has worked for me for years.
 
1 members found this post helpful.
Old 06-30-2022, 07:13 AM   #10
lukameen
Member
 
Registered: May 2004
Distribution: Slackware
Posts: 69

Rep: Reputation: 31
This what rkelsen is referring to when he mentions the win_credentials text file.
 
1 members found this post helpful.
Old 06-30-2022, 03:42 PM   #11
krakanut
Member
 
Registered: Aug 2012
Distribution: The Slackware
Posts: 62

Original Poster
Rep: Reputation: Disabled
I have tried all variants of the mount - here is the one I believe should work - I enter the AD password when it tries to connect. I have tried the creds file too. In all cases I can connect and browse but not write. Are the write issues on the server side or my linux user? Could be my naivete in thinking that everything on the server side should be tied to the AD user to which I am creating the share? Perahsp this is the wrong thinking?

sudo mount -t cifs -o username={my login},dom={my domain},uid=$(id -u),gid=$(id -g),forceuid,forcegid //192.168.25.8/shared work-shared/
 
Old 06-30-2022, 06:07 PM   #12
krakanut
Member
 
Registered: Aug 2012
Distribution: The Slackware
Posts: 62

Original Poster
Rep: Reputation: Disabled
A bit more to share. I get the same write issues using Dolphin smb mount. Again connects fine, reads fine but no write. I wonder if there is something on the Microsost server side I need to enable? but again, I can connect using a non-AD windows laptop, and r/w just fine using the same smb:\\ mount and AD user creds.
 
Old 07-02-2022, 08:49 AM   #13
krakanut
Member
 
Registered: Aug 2012
Distribution: The Slackware
Posts: 62

Original Poster
Rep: Reputation: Disabled
I should also note that even root sudo or full su can not write to the share after mounting. Below is a sample scenario...

Create mount: sudo mount -t cifs -o username={my login},dom={my domain} //192.168.25.8/shared work-shared/ {assuming just root access and usage}

cd into work-shared {I can maneuver all through the share just fine and open files; the issue is when trying to edit existing files}

sudo touch test_file {file gets created}

sudo vi test_file and modify; :wq then get Error: test: Permission denied; test: WARNING: FILE TRUNCATED.
 
Old 07-03-2022, 04:27 AM   #14
Tonus
Senior Member
 
Registered: Jan 2007
Location: Paris, France
Distribution: Slackware-15.0
Posts: 1,405
Blog Entries: 3

Rep: Reputation: 514Reputation: 514Reputation: 514Reputation: 514Reputation: 514Reputation: 514
I see you use sudo. What about testing with full root ?

Code:
su -
 
Old 07-03-2022, 06:48 PM   #15
krakanut
Member
 
Registered: Aug 2012
Distribution: The Slackware
Posts: 62

Original Poster
Rep: Reputation: Disabled
I tried full root (not sudo) and same issues.

However, losing patience with this matter, I pulled out an old workstation that has slack-current on it. That works exactly as expected! Why would Slack 15 not work and current would? How would I go about troubleshooting this - simply try re-installing 15 on the laptop I was having issues with?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Restrict SMB access for a particular domain blue_print Linux - Server 2 09-14-2010 05:23 AM
Sendmail doubling sender domain- ex. hostname.domain.net.domain.net halborr Slackware 7 08-23-2010 08:37 AM
IPtables - block subdomains (a.domain.com, b.domain.com, c.domain.com,...) benjalien Linux - Networking 6 06-24-2009 07:03 AM
SMB: More then one Windows user/ smb account? 1veedo Linux - Networking 2 03-15-2005 04:16 PM
Suse 9.0 smb access to nt-domain csager Linux - Security 1 02-05-2004 02:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 09:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration