Basic linux/samba question

For complex topics that regular users would not be interested in. For power users and database administrators.
Post Reply
abelaguilar
Posts: 87
Joined: Tue Jun 19, 2007 3:26 pm
Location: Manchester, GA
Contact:

Basic linux/samba question

Post by abelaguilar » Mon Oct 08, 2007 9:31 am

Wondering why samba will give me access to the specified folder in smb.cnf but not access to all subfolders from windows.
Abel Aguilar, DMD
http://www.DrAguilar.com

User avatar
wjstarck
Posts: 936
Joined: Tue Jul 31, 2007 7:18 am
Location: Keller, TX
Contact:

Post by wjstarck » Mon Oct 08, 2007 12:19 pm

Sounds like a permissions problem...

Cheers,

Bill Starck, DDS

abelaguilar
Posts: 87
Joined: Tue Jun 19, 2007 3:26 pm
Location: Manchester, GA
Contact:

Post by abelaguilar » Mon Oct 08, 2007 1:00 pm

so do I use chmod or chown?
Abel Aguilar, DMD
http://www.DrAguilar.com

User avatar
wjstarck
Posts: 936
Joined: Tue Jul 31, 2007 7:18 am
Location: Keller, TX
Contact:

Post by wjstarck » Mon Oct 08, 2007 1:28 pm

What folder (and subfolders) are you trying to gain access to?

Cheers,

Bill Starck, DDS

abelaguilar
Posts: 87
Joined: Tue Jun 19, 2007 3:26 pm
Location: Manchester, GA
Contact:

Post by abelaguilar » Mon Oct 08, 2007 3:00 pm

the folder is /var/lib/mysql

I want to have access to databases within mysql which are in separate folders.
Abel Aguilar, DMD
http://www.DrAguilar.com

User avatar
jordansparks
Site Admin
Posts: 5743
Joined: Sun Jun 17, 2007 3:59 pm
Location: Salem, Oregon
Contact:

Post by jordansparks » Mon Oct 08, 2007 7:24 pm

I've had trouble with Linux permission from day one. Every time the MySQL database is upgraded to a new version of OD, it reassigns the owner of certain database files to be 'mysql'. Then I have to change the permissions before I can make backups from my personal computer. My point is that even once you get the permissions set, you can expect to have to set them again later.
Jordan Sparks, DMD
http://www.opendental.com

abelaguilar
Posts: 87
Joined: Tue Jun 19, 2007 3:26 pm
Location: Manchester, GA
Contact:

Post by abelaguilar » Mon Oct 08, 2007 7:46 pm

can you post the commands you use to give this new database folder the correct permissions?
Abel Aguilar, DMD
http://www.DrAguilar.com

User avatar
jordansparks
Site Admin
Posts: 5743
Joined: Sun Jun 17, 2007 3:59 pm
Location: Salem, Oregon
Contact:

Post by jordansparks » Mon Oct 08, 2007 8:26 pm

Commands? I'm too stupid to type in commands. I just highlight my opendental folder, rightclick, permissions. Then I check the box to apply to all subfolders and click OK. I waste about 20 seconds performing this ritual every day.
Jordan Sparks, DMD
http://www.opendental.com

abelaguilar
Posts: 87
Joined: Tue Jun 19, 2007 3:26 pm
Location: Manchester, GA
Contact:

Post by abelaguilar » Mon Oct 08, 2007 8:30 pm

R U doing this in linux? can you be more specific?
Abel Aguilar, DMD
http://www.DrAguilar.com

User avatar
jordansparks
Site Admin
Posts: 5743
Joined: Sun Jun 17, 2007 3:59 pm
Location: Salem, Oregon
Contact:

Post by jordansparks » Mon Oct 08, 2007 8:32 pm

Yes, I'm doing this on Linux. I use SUSE which comes with the KDE graphical interface. Almost as good as MS Windows.
Jordan Sparks, DMD
http://www.opendental.com

abelaguilar
Posts: 87
Joined: Tue Jun 19, 2007 3:26 pm
Location: Manchester, GA
Contact:

Post by abelaguilar » Mon Oct 08, 2007 8:34 pm

Jordan when I right click on a folder in ubuntu distro I don't have the option to change permissions. Even when I R click , properties, and permissions tab is greyed out.
Abel Aguilar, DMD
http://www.DrAguilar.com

User avatar
jordansparks
Site Admin
Posts: 5743
Joined: Sun Jun 17, 2007 3:59 pm
Location: Salem, Oregon
Contact:

Post by jordansparks » Mon Oct 08, 2007 8:36 pm

Hmm. And you're logged in as root superuser?
Jordan Sparks, DMD
http://www.opendental.com

User avatar
jordansparks
Site Admin
Posts: 5743
Joined: Sun Jun 17, 2007 3:59 pm
Location: Salem, Oregon
Contact:

Post by jordansparks » Mon Oct 08, 2007 8:38 pm

Yes, I've seen the graphical interface block me from performing actions which it decided were dangerous. But var/lib/mysql/opendental (or whatever the path is) has never been a problem for me.
Jordan Sparks, DMD
http://www.opendental.com

abelaguilar
Posts: 87
Joined: Tue Jun 19, 2007 3:26 pm
Location: Manchester, GA
Contact:

Post by abelaguilar » Mon Oct 08, 2007 8:38 pm

no for some reason ubuntu does not allow the system administrator to log in, but there must be a way. i'll have to check google for that one.
Abel Aguilar, DMD
http://www.DrAguilar.com

User avatar
jordansparks
Site Admin
Posts: 5743
Joined: Sun Jun 17, 2007 3:59 pm
Location: Salem, Oregon
Contact:

Post by jordansparks » Mon Oct 08, 2007 8:40 pm

Doesn't allow the administrator to log in? How on earth do you expect to get anything done that way?
Jordan Sparks, DMD
http://www.opendental.com

abelaguilar
Posts: 87
Joined: Tue Jun 19, 2007 3:26 pm
Location: Manchester, GA
Contact:

Post by abelaguilar » Mon Oct 08, 2007 8:49 pm

well just found out how to change that. in ubuntu you get a admin password window before admin changes are allowed. Its supposed to be a security measure to prevent use of root and compromise security for computers connected to the WWW.
Abel Aguilar, DMD
http://www.DrAguilar.com

fcarlier
Posts: 75
Joined: Tue Jun 19, 2007 3:12 am
Location: Ghent, Belgium

Post by fcarlier » Tue Oct 09, 2007 10:15 am

This document explains you how to mark a file as executable using the Ubuntu user interface:

https://help.ubuntu.com/7.04/user-guide ... ermissions

Ubuntu doesn't allow you to log on as the root user - and for good reasons. You should never log on as the root user. If you log on as the root user, every program you launch has root priviliges. Imagine what can happen when you open a malicious program. (The same goes for Windows).

If you open an application on Ubuntu that requires administrator priviliges, Ubuntu will ask you for the password.

If you really want to execute a series of commands as root, you can always type

Code: Select all

sudo su
at the command line.[/url]
Frederik Carlier

ewlooney
Posts: 9
Joined: Fri Nov 02, 2007 12:17 pm
Location: Atlanta, GA

Post by ewlooney » Tue Nov 06, 2007 12:52 pm

Not sure if this is still an active topic...but here's a quick guide to help get you started in command line:

Chmod changes the permissions on files, Chown changes the owner. So, if you'd like to change them...

1) What are the permissions? Issue the following command to check them out:

Code: Select all

ls -tlrh
ls is a command to list contents of a directory. -tlrh are some arguments to alter the output. Here's what they stand for:

Code: Select all

t - sort by modification time
l - use a long listing formation (shows the permissions)
r - reverse the order, so the most recent things are listed on the bottom.  This is helpful if you have lots of files in a directory and are looking for the newest
h - Make the sizes human readable (show in KB, MB, or GB)
2) Change the permissions with chmod.

If you use the following code files will be come readable by everyone:

Code: Select all

chmod ogu+r *
ogu stands for "Other + Group + User"...that's everybody!

+r means to add read access to the following files...

* will give you all files in that directory.

Also, I agree completely with fcarlier. Logging in to Linux as root (or any other system with the equivalent, for that matter) can be a very bad idea. In Ubuntu the Windowing system (Gnome, KDE, etc...) will alert you when root permissions are required.

mnpbds
Posts: 3
Joined: Tue Oct 30, 2007 4:52 pm
Location: Essex, England.
Contact:

Post by mnpbds » Wed Nov 07, 2007 4:46 pm

jordansparks wrote:I've had trouble with Linux permission from day one. Every time the MySQL database is upgraded to a new version of OD, it reassigns the owner of certain database files to be 'mysql'. Then I have to change the permissions before I can make backups from my personal computer. My point is that even once you get the permissions set, you can expect to have to set them again later.
plus
Yes, I'm doing this on Linux. I use SUSE which comes with the KDE graphical interface. Almost as good as MS Windows.
plus
Commands? I'm too stupid to type in commands. I just highlight my opendental folder, rightclick, permissions. Then I check the box to apply to all subfolders and click OK. I waste about 20 seconds performing this ritual every day.
Hi Jordan,
From what you write above it seems you are using the KDE graphical interface to change the permissions on folder opendental. This is actually running the command chmod -R something.
This could be automated, so that you merely had to click on an icon on your KDE desktop. Here's how a database named "opendental" could be automatically backed up to a USB stick by clicking on a desktop icon that you create.
1. As root

Code: Select all

chown jordan /usr/share/templates/.source/Program.desktop
2. Then right click any space on your KDE desktop and select Create New, then Link to Application
3. On the various selection boxes change the permissions to executable, the command to

Code: Select all

sudo /usr/local/bin/saveToUSB
and the General box to SaveToUSB
4. Create a text file in folder /usr/local/bin called saveToUSB with the following contents

Code: Select all

#!/bin/bash
mysqldump -n -t -u root opendental > /mnt/usbstore/opendental.sql
and change it's permissions to executable (rwxr_xr_x) and owner root.
5. You should now have a desktop icon that you can click to execute the command to write a mysqldump to file opendental.sql on your usbstick.
There are plenty of other commands that can be automated on a KDE desktop in this way.
The directories might be slightly different for SUSE (I'm using Sidux which is Debian Sid based), but hopefully this will give you the general idea.
http://www.knoppix.net/forum/viewtopic.php?t=17570
is a link to a discussion where other scripts are outlined for automating the saving and restoring of mysql data under Linux.
Below are some snapshots that might help.
Regards,
Mark Preston

ImageImageImageImageImage

User avatar
Justin Shafer
Posts: 596
Joined: Sat Jul 28, 2007 7:34 pm
Location: Fort Worth, TX.

Re: Basic linux/samba question

Post by Justin Shafer » Tue Mar 18, 2008 1:12 pm

Weird. I Havent tried this.... I dont think. This could most likely be achieved in the samba user file or maybe done with chmod 777 * which might be more then you want.... Or what if you added the user to the mysql group?

But what if the samba user file just mapped like
samba user=joe unix user accounts=joe, mysql

example of the smbusers
http://users.tkk.fi/~jwagner/pdfServer/smbusers

I wonder if this would work..... maybe not.
# Unix_name = SMB_name1 SMB_name2 ...
root = administrator admin
nobody = guest pcguest smbguest
mysql = smbuser
user = smbuser

Hmmm kind of doubt it. But it might.... Dont know who would be the owner if a file was saved though... maybe mysql because it was specified first... :D Doubt it.

Nemesis
Posts: 3
Joined: Wed Apr 30, 2008 10:40 am

Re: Basic linux/samba question

Post by Nemesis » Wed Apr 30, 2008 11:00 am

This could be automated, so that you merely had to click on an icon on your KDE desktop.
I think that if you create a script that changes the permissions and you put it in the automated startup tasks (example: chmod the permissions to 777 on folder X) it will be more easier than cliking it every day.

mowgli
Posts: 134
Joined: Fri Sep 14, 2007 1:42 pm

Re: Basic linux/samba question

Post by mowgli » Tue May 06, 2008 12:46 pm

I think it's a lot easier to allow the "mysql" user on the Linux server to maintain ownership of the files, and not play around with trying to change permissions. That's partly what makes it more secure than a Windows network share. Then use "mysqldump" utility to get a backup; for example:

mysqldump -v -h linuxhost -u root opendental > d:\backups\odbackup.sql
xcopy s:\OpenDentImages d:\backups\OpenDentImages /i/e/d/k/r

Using those commands in a batch file, a Windows machine could copy the database and image folders to its D: drive. The S: drive would be the Linux Samba share. Better still, if the Windows machine is a backup MySQL server, it can pass the running database to "localhost" with this:

mysqldump -v -h linuxhost -u root opendental | mysql -u root -C opendental

The -v switch for "verbose" just lets you see what it's doing.

Post Reply