LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-24-2021, 10:06 PM   #1
treasurehunter613
LQ Newbie
 
Registered: Dec 2021
Posts: 1

Rep: Reputation: Disabled
Unhappy How to use an environment variable in smb.conf?


I have researched and researched and I can't figure out what I'm doing wrong.

I have added

UUID=44DC4A9EDC4A8A5E

to the /etc/environment file and I have verified and confirmed that it is indeed set as an environment variable with printenv UUID and export. Running echo $UUID displays the UUID without any problem. The UUID is for my external HDD at /dev/sda1 and I have verified and confirmed that it is correct.

What I'm trying to do in smb.conf for my samba share is this:

[Raspberry Pi External HDD]
comment = Western Digital 5tb
public = yes
writeable = yes
browsable = yes
path = /media/pi/%$(UUID)
create mask 0777
directory mask = 0777

However, it doesn't work. If I replace %$(UUID) with the actual UUID it works fine.

What am I doing wrong?
 
Old 12-25-2021, 07:36 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,892

Rep: Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317
cross post: https://www.reddit.com/r/linux/comme...le_in_smbconf/ (and answered)
 
Old 12-25-2021, 08:56 AM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,724

Rep: Reputation: 5918Reputation: 5918Reputation: 5918Reputation: 5918Reputation: 5918Reputation: 5918Reputation: 5918Reputation: 5918Reputation: 5918Reputation: 5918Reputation: 5918
What version of samba is running on your Pi and does it support environment variables?

In my opinion it would be better to hard code the path nam

testparm checks the smb.conf for syntax errors. If it passes then I would assume it is supported.

Also check the log files for errors

Last edited by michaelk; 12-25-2021 at 10:16 AM.
 
  


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
Environment variable that dynamically changes when another variable is changed youtoo Linux - Newbie 4 02-17-2016 01:44 AM
smb.log / smb.conf problem (printcap) on VU+DUO tuner using Samba xlarge Linux - Newbie 0 01-04-2011 05:10 AM
AWK a variable Ouptut to a new variable and using the new variable with the old one alertroshannow Linux - Newbie 4 02-16-2009 12:08 AM
Samba in Debian, smb.conf: smb passwd file = ?????????? henrnorl Linux - Software 1 10-06-2006 09:43 AM
samba conf smb.conf regnier Mandriva 5 02-17-2005 04:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:09 AM.

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