Windows file share under Cygwin? - windows

I have an issue with mounting Windows file share in Cygwin.
We have Windows file share which is using NFS to share content. I was assigned to install Cygwin on it so some application can connect over SFTP to that server.
Now they need to access the shared folder from that application and the app would pull data from that folder.The thing is that the folder is Windows shared folder (exmple; \server\photos). the current Windows users need to be able to connect to that share (it is mapped to their M drive) and the app need to connect to SFTP and pull the data from there.
My idea was to mount that NFS share in Cygwin and set it as /home directory so when the app connects, it automatically goes there.
My questions are: is this possible, and does anyone know any better solutions?
I am open for all suggestions.
Thank you.

Cygwin views the top of its directory tree / to be within the Windows directory C:\cygwin64 (or whatever its installation directory was). As a result, you are unable to move above that point in the filesystem from a Cygwin shell. The solution is to go through Cygwin's directory /cygdrive, which is automatically set up as the access point where all Windows disk drives are mounted. If your shared folder is mounted in Windows as M:, you should be able to access it in Cygwin as /cygdrive/m without any additional work.
As far as setting it up as /home, you might be able to create a symbolic link from /home to /cygdrive/m if that is what you need.

Related

How to query if a particular folder is shared or enumerate folders shared from the local machine on osx in C/C++ or Objective C

I'm currently developing on macOS High Sierra (not Windows) using Qt. Just using regular macOS rather than macOS server. I'm happy to write Mac-only code outside the Qt bubble to fix this problem, obviously.
I'm looking for a way to programmatically check in C/C++ or Objective-C whether a particular local folder is shared on the local network. Alternatively I'd like to retrieve a list of all shared folders. I'd like the method to work on a reasonably large range of macOS versions e.g. 10.9 to 10.14.
I need to do this in order to rewrite paths to local files as UNC paths so that they are accessible from a Windows client machine on the same network via SMB sharing with suitable credentials. This does assume shared folders have already been setup but if they haven't the user will receive an error and be prompted to share suitable folders.
I can share/un-share and see the sharing status of a folder using the Get Info dialog in Finder but I'm looking for something I can use within an application.
Things I've tried without success:
Searching for other instances of the problem
NSURL class - doesn't document a resource name to query for its sharing status.
smbutil doesn't seem to list shares being shared from the machine it's running on.
smbd doesn't seem to have any command line options to query shared folders.
The various configuration files mentioned in the smbutil and smbd.conf man pages don't contain a list of shared folders
mdls doesn't contain any relevant metadata in the output for folders that are shared.
ls -l# doesn't list any extra information for shared folders
Sharing an unusually named folder and greping the hard disk for the folder name including binary files to see if this information is persisted somewhere. Presumably it is persisted somehow because the folder is shared after rebooting but I can't find any record of the folder name anywhere.
OpenDirectory services seem to contain lots of references to SMB in the headers but I can't see a way to use OpenDirectory to get a list of folders shared from the local machine.
Sharing the root folder so that the rewriting is trivial. This works but it's pretty undesirable to share a root folder.
Perhaps there's a better way of doing the access that will sidestep the need for having and querying SMB shares...?
Found the answer elsewhere on stackexchange answered by mivk.
Run the following command and capture the output.
sharing -l
This gives a slightly verbose list of file shares with separate details for afp and smb which can be parsed to get a list of shared folders on the local machine. Tested on Catalina. It's possible that this command will fail to run if file sharing is not enabled in System Preferences.

Virtual Box Shared folders on Mac backup to external harddrive

So I found out how to share folders using Virtual Box and running Windows 8.
I was wondering, if I save files or projects from Windows 8 to the shared folder on my Mac, will TimeMachine backup those files onto my external harddrive? The hard drive is of course formatted for Mac because of that whole debockel, but that is besides the point. Even though the files were made in Windows.
Also...My assumption is that I would not be able to access the files on my external formatted hard drive from Virtual Box running Windows 8. Is this true?
To my knowledge, you cannot access the files on a journaled formatted hard drive from Windows without extra software. If I understand you correctly, you are trying to backup files created in the Windows VM within your Time Machine backup hard drive?
I'm sure you have solved this by now, but you should consider backing up the VM itself. If the files on the Windows Machine are important you can leave them in a shared folder and have time machine back up that folder.

automatic Samba share script

I have an Ubuntu 10.04 server running Samba.
I want to write a script (for Linux or Windows computer) that, given the IP of this server and the path of the shared Samba folder, can automatically create a "network drive" icon on the desktop. Both machines are on a local network.
I realize this will be different for linux/windows.
Any suggestions? I'm just not sure where to start. Thanks!
For Windows machines, you want to look at net use. For instance, to map the share "Data" on 192.168.0.2 to Z:, you'd write net use Z: \\192.168.0.2\Data. There is a lot of options, so check net help use for a complete list. For instance, you might want to look at /persistent, which would automatically recreate the share every time you log in.
Or you could put this in a .BAT file which is executed when logging in.
On linux, I think you'd generally have to be root to do this, as it'd require a mount command. I know some desktop environments (such as GNOME) get around this, but to acually mount it you need root. The command to mount the same share at the mountpoint /mnt/Data would simply be mount //192.168.0.2/Data /mnt/Data, if you allow anyone access. If you require a logon, you need to add -o User=YOURUSER. You will then be prompted for a password.
(Note that this requires the CIFS/SMB drivers to work)

Setting Permissions on files shared between Linux and Windows on EMC Celerra

I have an EMC Celerra filesystem shared between Windows and Linux Clients. User A on a Windows client creates a directory and set of files and User B on a Linux client is to modify and/or delete these files; however the files and directory to not have write permission for anyone other than the original owner. If this was on a Linux NFS share, I could use umask to set the permissions to allow group write permissions. Is there a way for the Windows client to set the correct permissions on the files when created? Or is there a way to do this on the EMC Celerra? I can write a script to perform a chmod on the Linux side but wanted to avoid this if possible.
Thank you,
JP20036
Old question, but if you are managing the Celerra share via Windows you can set permissions there and you can set it so that any user has wright permissions pretty easily from the share creation wizard. Try recreating the share and coming at the permissions that way (obviously OP is no longer looking for an answer, but just in case anyone googles it).

p4v getting files as writable

Perforce is downloading files to the external hard-drive connected to my MacBookPro as writable ("777"). It's as if the "allwrite" option is set in my workspace, but it's not.
I thought Perforce was supposed to mark the files read-only until I check them out. Is there a setting somewhere I missed?
Rev. P4V/MACOSX104U/2009.2/236331
MacBookPro OSX 10.5.8
Is your external hard-drive formated as hfs+? If it's FAT32, it will be 777 anyway.
Have you checked if Windows thinks the files are read only after syncing with the Mac client?
Perforce does not like it when you access the same disk location from two different workspaces, nor the same workspace from two different hosts. This is because the server tracks the state of the files on the client; you're begging for your local store to lose synchronization with the depot.
What are you really trying to accomplish here?
I would recommend that you forget about FAT32; put your Windows workspace on an NTFS volume and your Mac workspace on an HFS+ volume. Submit & sync to share the data. Storage is cheap.

Resources