Can i set Ubuntu's "Documents" folder to = "My Docs" in Windows?

Asked by Tom

Hi :)
I was wondering if i could make the "Documents" folder in Ubuntu just be a sym-link (or something) to a specific user's "My Documents" folder & then set Ubuntu's "Picture" & "Video" to the Windows ones? I realise that Windows might not always read all the formats that linux can but that might show my work colleagues the limitations of Windows fairly neatly.

If that is possible then is it possible to make those symlinks be set to smb:/// folders? If users could login on any machine in the building and have easy access to all their work stored safely on the file-server (which runs on Debian (same family as Ubuntu of course ;) )) then people at work might be a bit more interested in my installs of Ubuntu. They are just beginning to learn that Windows desktops are not secure places for confidential files and so are beginning to keep stuff on the file-server.

I often give machines a separate /home partition which is something that Windows can't do (even Win7 does it's equivalent badly). Having different logins for different people taking them directly to the network file-shares would take things a big step further and would be awesome.
Good luck and regards from
Tom :)

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu util-linux Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

Do you mean use the files on an NTFS partition as the user data in Ubuntu (in a dual boot situation), or do you mean a network share?

Revision history for this message
marcus aurelius (adbiz) said :
#2

it sounds like you want to save all your documents in the "my docs" folder that is in the windoze partition. it's not necessary to set symlink. you can, in nautilus, just drag and drop the "my docs" subdirectory onto the nautilus sidebar. "my docs" will be available whenever you're opening/saving files in ubuntu, provided that the windoze partition doesn't crash.

Revision history for this message
Tom (tom6) said :
#3

Hi :)
Thanks. I think i will ask again another time. I confused the issue by asking 2 questions at the same time. Lets go to the simpler case and i will try about the network issue another day.

When you click on the "Places" menu there are a series of about 4 folders named things like;
home
user
Documents
Music
Pictures
Video

Those folders appear in a lot of the gui interface, for examples when you save or try to open a document from inside an app. Also if you look inside the /home folder there are a number of users. If you look inside your user-folder those same sub-folders appear. For example
/home/user/Documents
/home/user/Music
/home/user/Pictures
/home/user/Video

If you add a camera to your system it tries to save pictures in the "Pictures" folder (by default). If you try to save a home-movie it tries to default to "Video" and if you have an instrument it would presumably default to saving in "Music".

Windows deals with it slightly differently. However, there is a "My Documents" folder and a "My Music" and a "My Pictures" and a "My Videos" folders.

Sure, i can bookmark those folders and/or add them to the sidebar but that then means there are 2 folders for Documents, 2 for Music and so on and it is not completely obvious which one people may have used at which times. It is also unclear which is the Windows one and which is the Ubuntu one. Could i have just 1 set of those folders and have that set all on the Windows partition?

I'm not sure if that has made things less confusing or more confusing to you.
Apols and regards from
Tom :)

Revision history for this message
delance (olivier-delance) said :
#4

You could make symbolic link to Windows partition. You will have to use command "ls -s link_name folder_target".

Revision history for this message
Eliah Kagan (degeneracypressure) said :
#5

@delance
You mean "ln -s folder_target link_name" right? (http://manpages.ubuntu.com/manpages/maverick/en/man1/ln.1.html)

@Tom
If you want to make your Documents folder in Ubuntu a symbolic link your My Documents folder in Windows, as delance suggests, then here are some less technical instructions, which don't require you to have prior experience using the Terminal:

(1) Make sure your Documents folder in Ubuntu is completely empty. Move all files in it to your My Documents folder on the Windows partition, or to some other location.

(2) Delete your Documents folder in the Ubuntu system. (If you don't do this, then in the subsequent steps you'll end up creating a symbolic link called Documents *inside* the Documents folder in Ubuntu, instead of what you want to do, which is to put a symbolic link called Documents **in place of** the Documents folder in Ubuntu.)

(3) Browse through your Windows partition, so that you can see your My Documents folder. (Not its contents, but the folder itself--so if this is a Windows Vista or Windows 7 system, then at this point you should be viewing the contents of the Users/your-username folder inside the Windows partition, where your-username is replaced with your actual user account name from the Windows system.)

(4) Open a Terminal window, and type (or paste) in the text "ln -s " (without the quotes, but with the space at the end). Don't press enter yet. Instead, drag your My Documents folder into the Terminal window. That pastes its full path into the Terminal, using syntax that the Terminal understands. Then type (or paste) " ~/Documents" (without the quotes, but with the space at the beginning). Please note that the ~ (tilde) character is the character that is produced by holding down Shift and pressing the key immediately to the left of the numeral 1, on a US English keyboard. Now finally press enter.

(5) If you get any message, or you get no message but this did not have the effect you wanted (of making your Documents folder actually be a symbolic link to your My Documents folder, so when you go into your Documents folder you see the contents of your My Documents folder), then select all the text from the Terminal (Edit > Select All), copy it to the clipboard (Edit > Copy), and paste it here. On the other hand, if you got no message in the Terminal when you ran that command, and the Documents folder is acting like it's the My Documents folder in Windows, then you have succeeded.

Revision history for this message
Eliah Kagan (degeneracypressure) said :
#6

"If that is possible then is it possible to make those symlinks be set to smb:/// folders?"

Yes. However, to accomplish this, you should mount the Windows network shares as drives on the Ubuntu system. To do that, you can use the smbmount command. You can also edit /etc/fstab and add lines for them (in that case, it's useful to know that "smbmount ..." is like "mount -t smbfs ...").

So, suppose you have a computer called HOSTNAME with a share you want to mount called SHARENAME, and your user account on that computer is called USERNAME. Suppose further that you want to mount it in in the MOUNTPOINT subfolder of your home folder. Then you could create the MOUNTPOINT folder, make sure the MOUNTPOINT folder is empty, and run this command in the Terminal:

smbmount //HOSTNAME/SHARENAME ~/MOUNTPOINT -o user=USERNAME

(I am not actually suggesting that it is a good idea to name hosts, shares, users, and folders with all capital letters--I just chose those examples so that it's clear that they're the variables for which you'll substitute your own values.)

You'll probably be asked for your password--don't worry that as you type it in, you don't see any placeholder characters like *. If you have any problems when you run that, please feel free to post the text from the Terminal here.

If the username is the same as the name of your user account on the Ubuntu system, then you can leave out "-o user=USERNAME". However, if you run the command as root (this will happen if you prefix it with sudo, which you might want to do if you want it mounted inside /media with your other volumes), then it will default to trying to log on to the Windows/Samba file server as root, which is not what you want, so in that case you must include the "-o user=USERNAME".

Please note that, to use smbmount, or to automount a share from /etc/fstab with -t smbfs, you need to have the Ubuntu package called smbfs installed.

See http://manpages.ubuntu.com/manpages/maverick/en/man8/smbmount.8.html for more details.

Then you could create symbolic links to these mount points:

ln -s ~/SHARENAME ~/SYMBOLICLINKNAME

(In case you haven't figured this out yet, ~ represents your home folder. It is, generally speaking, equivalent to $HOME, or to typing out the name of your home folder. Of course, the meaning of ~, and of $HOME, change when you log in as a different user. Thus, the above metaexample assumes that the share's mount point is a subfolder of your home folder, and that you want to put the symbolic link to it directly in your home folder as well. You can easily modify the above example to generalize it.)

However, you might not want to create symbolic links to the mount points, because you can just make the bookmarked folder (i.e., the folder shown in the Places menu) *be* the mount point (so long as this folder is empty--mount points must be empty folders, since it wouldn't make sense for a folder both to contain its own files and to represent the root of a separate volume or network share). For example:

smbmount '//FILE-SERVER-HOSTNAME/My Documents' ~/Documents -o user=USERNAME

In this example, I made the share name "My Documents" which has a space in it. Therefore, it was necessary to enclose it in quotes. One of the other reasonable options there would have been to escape the space by preceding it with a single \ (backslash):

smbmount //FILE-SERVER-HOSTNAME/My\ Documents ~/Documents -o user=USERNAME

With that said, though, I recommend leaving spaces out of your share names (of course, if you're accessing other people's shares, this is not a choice you have to make). Even if you're only using Windows systems, that tends to simplify things (as people perform tasks with command-line utilities on Windows systems too).

Revision history for this message
Eliah Kagan (degeneracypressure) said :
#7

"They are just beginning to learn that Windows desktops are not secure places for confidential files and so are beginning to keep stuff on the file-server."

I'm tempted to ask why your file server would be more secure than their desktops. But instead, I will just suggest that you think about this issue, at least if you are representing it to your users as being more secure.

If your users' individual machines, which have access to their shares on your file server, are compromised, then the contents of their shares on your file server are certainly subject to compromise also. (Not your file server itself, so long as everything is configured securely--but anything they can access from their computer is something that an intruder into their computer can access.)

"I often give machines a separate /home partition which is something that Windows can't do (even Win7 does it's equivalent badly)."

At the risk of going a bit off-topic....

Windows is perfectly capable of doing this, and has supported this since well before Windows 2000, but it is slightly more technical than on Ubuntu. (And Windows 9x/ME doesn't support it.)

In this example I'm calling the directory that contains home directories C:\Users because it's easy to type, but before Windows Vista it is of course C:\Documents and Settings.

To accomplish this, just make C:\Users an NTFS junction pointing to the drive you want. So, if C: is your system drive and you want all the home directories as subdirectories of the root of D:, then you could move the folder C:\Users to D:\, and then, assuming you're using Junction (http://technet.microsoft.com/en-us/sysinternals/bb896768):

junction C:\Users D:\

Of course, you can't do this while the Windows system is running normally...at least not if you (or anybody) is logged on. Obtaining a LOCAL SYSTEM command prompt without ever logging in (search the web for "sethc.exe" if you don't know what I'm talking about) *might* be one way to do it, provided that no indexing were occurring and nobody were accessing any files in C:\Users (e.g., through a network share). But a better bet would probably be to perform the recursive move and junction creation options from a Windows live CD (BartPE or ERD Commander 2005 would probably work well), or from the Windows recovery console.

Junctions across network drives are also possible, but only when using a Windows domain.

Revision history for this message
Tom (tom6) said :
#8

Hi Delance, Eliah :)

Thanks for your responses. I wondered if Ubuntu would then treat those folders as native ones. For example if i plug in a camera would it automatically choose "My Pictures" to save photos too? In Firefox it is easy to change the default folder it uses for downloads by
Edit - Properties - General
and in the downloads section click the "Browse" button. Does Ubuntu have a global settings place to ensure that the 'right' folders are being used by default for documents, music, pictures and videos?

Eliah, re: security
When my colleagues boot up Windows they are asked for a username and password before being allowed access to their "My Documents" folder. Most machines have 2 or more usernames that can login. When logged in as one user they can't access files stored in the "My Documents" of another user.

By contrast i can boot into a LiveCd of Ubuntu (much faster than the Windows boot btw) and can then access all folders and files stored by any user. However, i don't know how to find out what those users settings are for logging onto the network. Hence even a Windows file-server might be safer than the desktops but we have Debian on our file-server.

So i still wonder if those Windows folders ("My Documents" etc) will be used properly by Ubuntu?
Many regards to everyone that has responded so far
Many thanks and regards from
Tom :)

Revision history for this message
Eliah Kagan (degeneracypressure) said :
#9

> I wondered if Ubuntu would then treat those folders as native
> ones. For example if i plug in a camera would it automatically
> choose "My Pictures" to save photos too?

Anything that used the Pictures folder inside your Ubuntu home folder (i.e., /home/your-username/Pictures) would keep using that folder. But that folder would have become a symbolic link to your My Pictures folder on your Windows partition, so saving files inside it would really save them inside My Pictures, viewing its contents would really be viewing the contents of My Pictures, and so forth. It would still be called Pictures, rather than My Pictures, which is presumably what you want.

If you want to change the name of the symbolic link, you can do that, but if you're willing to do that, you might as well just remove the bookmark to Pictures (which removes it from the Places menu), and add a bookmark to your My Pictures folder on your Windows partition, and then configure your applications to use that folder. I am guessing that the reason you don't want to do this is that you don't want to have to reconfigure applications that default to using the Pictures subfolder of your home folder. If that is the case, then the above solution will do what you want.

I hope to get around to posting again about the security issues soon.

Revision history for this message
Eliah Kagan (degeneracypressure) said :
#10

Sorry, I missed a point in your post.

"Does Ubuntu have a global settings place to ensure that the 'right' folders are being used by default for documents, music, pictures and videos?"

No. But if you have multiple applications that use a folder, such as ~/Pictures, and you make that folder a symbolic link to another folder, like My Pictures on your Windows partition, then every application that defaults to ~/Pictures will, in effect, be using My Pictures on your Windows partition.

I'll reply about security soon.

Revision history for this message
Eliah Kagan (degeneracypressure) said :
#11

Regarding security, first of all, please note that, as far as I can tell, you have not actually answered my question about why your file server would be more secure than users' desktops. That's OK (as I said, you don't have to answer that, and anyway there are often reasons besides security for storing documents on a central server)...I just want to make sure you're aware of it, in case I'm missing something and you were in fact intending to answer that question.

"By contrast i can boot into a LiveCd of Ubuntu (much faster than the Windows boot btw) and can then access all folders and files stored by any user."

That's not a contrast between Windows and Ubuntu. That's a contrast between installed systems and live CD's, or, more precisely, between a system on which the user has local administrator powers and a system on which the user does not have such powers.

If you were to boot from a Windows live CD, like ERD Commander 2005 or BartPE, you would have access to everyone's files too. If you were to take the hard drive out of the computer and put it in an enclosure, or inside another computer, so that it is another machine's secondary hard drive, then an administrator on that other computer would have access to all the files (whether the operating system were Windows, Ubuntu, or something else altogether). When you boot from the Ubuntu live CD, the user account that you are given has administrative privileges, and can (sometimes through being able to elevate privileges to root, sometimes even without doing so) perform any action whatsoever that the operating system is capable of doing or allowing to be done. This certainly includes accessing any files on any filesystem supported by Ubuntu, including NTFS. On an installed Ubuntu system, the user created during the installation process is created as an administrator, but (a) that user account doesn't have to retain administrative power (though there should be *some* user with administrative powers), and (b) that user account doesn't have to be the one that gets used by the regular user of the machine whose privileges you want to be limited.

Please let me know if that doesn't make sense, and I'll explain it another way. It is an extremely important point about security, and about what you can secure and what you cannot secure. While I presented it in a way geared toward Ubuntu, it is a point that transcends the question of what operating system(s) you are using.

As an extension of the above point (not a further explanation of it, but another, related point), if you want to lock down your machines so that it is prohibitively difficult for their users to gain local administrative access (local means as applied to the specific machine, rather than over the network), then you must:

(1) Physically lock the computers in place so they cannot easily be removed to another location, or hire security guards who will notice and immediately act when someone attempts to move a machine.

(2) Physically lock the computers' chassis shut, so they cannot be opened, or implement even more vigilant security, sufficient to notice this and stop it.

(3) If necessary, perform additional steps to constrain access to any drives which contain an operating system you allow to be booted from (see point 5) or which contain files to which you want to control access (see point 9). Specifically, this typically means locking SCSI hot-swap bays and avoiding the use of external USB drives for aforementioned purposes. (It's still OK to allow users to use external USB hard drives and flash drives, just not for those purposes.)

(4) Set an administrator password in the BIOS, so that users besides you cannot change the BIOS settings. Otherwise point 5 cannot be enforced. (There are other, secondary reasons this is important, too.)

(5) Change the boot sequence (also sometimes called "boot order") so that the only drive that can be booted from is the individual hard drive that contains the installed operating system(s) (or which contains the boot loader, which is usually on the same drive as the installed operating system(s), or at least the same drive as one of them). This prevents people from booting from live CD's.

(6) If you are using an advanced boot loader like LILO/GRUB/GRUB2/BURG (this applies to Ubuntu, current versions of which use GRUB2 by default, but I don't think it applies to the Windows boot loader), lock it down so that people cannot use it to boot from a live CD, enter recovery mode, or change the parameters passed to the operating system (so as to enable them to elevate their privileges once booted). See http://ubuntuforums.org/showthread.php?t=1369019.

(7) Disable single-user mode, or set a password for it. On a Windows system, the only single-user mode that works out-of-the-box is the recovery console, and that cannot be accessed without booting from a CD, so you're OK. On a Linux-based system, such as Ubuntu, locking down your boot loader properly will render the single user mode ("recovery mode") inaccessible, so you're OK. On some other operating systems, including Mac OS X, you must perform another step to disable single-user mode.

(8) Ensure that the user's account does not have administrative privileges.

(9) Ensure that the system as a whole (for example: application settings, file permissions) is configured properly so that non-administrative users cannot perform any actions that you want restricted to administrators.

Of course, if these are single users systems and/or you have a reasonably high level of trust for the users, then you may not want to accept the hassle of these steps. (It's not that much hassle to set up, but it does add hassle in using and servicing the computers. In particular, you may want users to be local administrators over their own machines.)

There is one other issue that will arise if you want to enable limited users to access NTFS volumes on Ubuntu, but you want to enforce access control at the per-file level. By default, Ubuntu will mount NTFS volumes in a way that does not recognize or respect file permissions on them. This is because the systems of file permissions in Ubuntu (with Unix-style file systems like ext2, ext3, ext4, UFS/FFS, ReiserFS, and the like) are somewhat dissimilar to NTFS file permissions. However, you *can* mount NTFS filesystems in a way that recognizes and respects these permissions, or at least a very reasonable approximation for them. See http://b.andre.pagesperso-orange.fr/permissions.html. Please note that, for this to be effective at restricting access, you must prevent users from remounting NTFS volumes containing files to which you want to control access with different options (disabling respect for these permissions). If you find that you need help controlling access to--including the ability to mount--specific devices or partitions, please feel free to ask. I recommend reading up on udisks and the fstab.

"However, i don't know how to find out what those users settings are for logging onto the network. Hence even a Windows file-server might be safer than the desktops but we have Debian on our file-server."

As I mentioned at the top of this post, you still have not explained what is insecure about users' storing files on their local machines in Windows. In terms of controlling access to Samba network shares on the Debian system, you're right that if you don't know how this is configured, then you could very well be engaging in an extremely insecure practice. You should find out what the access restrictions are on your network shares!

I don't know which of the various methods you used to configure Samba on the Debian server, so I cannot give you quick, certain instructions about how to check how it's configured. Furthermore, for you, this is currently primarily an matter affecting Samba on a Debian server accessed by Windows clients, so it seems outside the scope of Ubuntu. You may want to ask on a Debian forum. But Debian and Ubuntu are similar, so if you read up on Samba in Ubuntu, as well as Samba in Debian, you should find the answer you're looking for. If you don't, please feel free to post a new question about this. Like with SMB/CIFS in Windows, a Samba server on a Unix-like operating system like Debian, Ubuntu, or Mac OS X can be configured securely or insecurely, and precisely what constitutes a secure configuration depends on the needs and conditions specific to your environment.

Can you help with this problem?

Provide an answer of your own, or ask Tom for more information if necessary.

To post a message you must log in.