network-share interview questions
Top network-share frequently asked interview questions
I'm trying to push locally to a shared repo on a network drive. I'm getting the following error:
:~/git push origin master
Counting objects ... done
Writing objects ...
Total ....
but then:
fatal: cannot pread pack file: No Permission
error: unpack failed: index-pack abnormal exit
To /networkshare/repo.git
! [remote rejected] master -> master (n/a unpack error)
The rights on the remote directory are like this:
:~/ls -all
drwxr-xr-x ndbd MyGroup Date Repo.Git
any clue?
Source: (StackOverflow)
Our application allows users to read-write files in a share at \\foo\bar$. An administrator granted "Everyone" read-write permissions on both the Share Permissions and Security tabs. When a domain user tries to write to that share, our application logs the following:
TYPE: System.UnauthorizedAccessException
MSG: Access to the path '\\foo\bar$\00074458_00076402.tif' is denied.
SOURCE: mscorlib
SITE: WinIOError
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite)
at Ceoimage.Basecamp.DocumentServers.DirectAccessServer._TryCommitQueueFile(IDocQueueFile file)
at Ceoimage.Basecamp.DocumentServers.DirectAccessServer.SendQueuedFiles(Int32 queueId, Int32 userId, IDocQueueFile[] queueFiles)
at Ceoimage.Basecamp.ScanDocuments.DataModule.CommitDocumentToQueue(QueuedDocumentModelWithCollections queuedDocument, IDocQueueFile[] files)
I do not have a domain account, so I cannot test the effective permissions of this user, but does "Everyone" extend to domain users? Do domain users have to authenticate to the server in addition to Active Directory if "Everyone" is considered a local principal? Is it considered a local principal?
Our application is a .NET WinForms app running on a Windows 7 client on a Windows domain, trying to access a file server running Windows Server 2008 R2 Standard SP 1. In case you can't tell, I am a bit out of my depth here.
Source: (StackOverflow)
I have a problem with Windows Forms (.net 4) application. One of our clients wants to run it from network share (our app can be used by 20-300 users at the same time). We were able to get it to work by adding this line to app.config
<loadFromRemoteSources enabled="true" />
It takes a moment to start the program and after a while users can work. Unfortunately they noted that when the application is not used for some time and they want to use it again, the response is very slow (it takes about 1-3 minutes to 'wake up' the app). At least that's what I've heard from our consultant.
I'll probably see it myself on next Monday, but first of all I would like to know:
- Is this behavior normal, and if so, why?
- What tools should I use to investigate this issue?
Source: (StackOverflow)
We are a team of less than ten persons that need to quickly set up a git server that supports active directory based authentication.
The simplest solution seems to be to use a file share with a bare git repository and reaching it using a unc path, e.g.
git clone //server/share/repo.git
However, we are a bit worried about robustness. Are there no issues with concurrency when several people use the same git repository and there is no actual server component running?
Clients are running windows 7, server is Windows Server 2008R2. Using msysgit 1.8.1.2
(I am well aware that there are many other git server solutions, but, especially given the requirement of AD authentication, they are not as simple to set up)
Source: (StackOverflow)
I have two computers with Windows Server 2003. One computer has some shared folders on the network, and the other has a Windows Service (written in C#, running under the Network Service account) that needs to access those shared folders.
The following code works fine as a logged-in user, but throws an exception when executed under the Network Service account.
File.WriteAllText(@"C:\temp\temp.txt", File.ReadAllLines(@"\\NetworkServer\Test\test.txt")[0]);
The exception message is Logon failure: unknown user name or bad password
. How do I get this code to work under the Network Service account? Is it a setting in Windows Server 2003, or do I need to add some code to this to make it work?
Source: (StackOverflow)
.Net provides us with a FolderBrowserDialog control to browse for folders. This is however a modal dialog box. I need to create a user control that I can drop onto my form. So, I have been looking at creating my own, where I need to get all local drives, mapped network drives, UNC shares and web folders (WebDAV/SharePoint). I am using Windows 7 and .Net 4.0.
Local and Mapped Network Drives
I can get the local drives from DriveInfo.GetDrives(). However, these are only showing me the drives that are available/online. In Windows Explorer, you also see mapped network drives that are disconnected/unavailable.
Network Folders/UNC Shares
From what I have found so far, there does not appear to be a mechanism in .Net to enumerate the UNC shares. It seems that I have to use Interop to Win32 APIs to use the WNetOpenEnum
and WNetEnumResource
functions to enumerate the network neighborhood. I got this working, but was wondering if there was not another way.
Web (WebDAV) Folders and SharePoint
In Windows Explorer I configured a few WebDAV folders. Using the same Interop calls above WNetOpenENum
and WNetENumResource
I got a node "Web Client Network" and the WebDAV folders that were connected and accessible appeared.
Questions
- How do I get the mapped network drives that are configured, but are offline?
- Is there another way to enumerate UNC shares, or am I stuck with using the above named interop calls?
- The
WNetEnumResource
was returning to me an empty node for "Microsoft Terminal Services". How can I filter this out, without filtering based on the English text?
- The web folders returned by
WNetEnumResource
are not the user friendly names I assigned to them when I created them, but are in the format of IP-Address@Port, e.g. \\nnn.nnn.nnn.nnn@18123
. How do I get the user friendly names for the web folders?
- The web folders that were offline, did not appear at all, yet in Windows Explorer these are appearing. Any suggestions on getting the ones that are offline?
Source: (StackOverflow)
I have a .NET 3.5 application that I wish to install on the client's server and have workstations run it directly from the network share. I've read a bit that seems to suggest this isn't as easy as simply copying the application to the network share like I would for a native exe. Unfortunately, there seems to be a lack of documentation on the correct/best way to do this (via ClickOnce or otherwise).
So, how would I go about this type of deployment? Do I just copy the assemblies? Is there something with ClickOnce that can make my life easier and facilitate future updates? (Bear in mind, each client will have a different install point on their local server.)
What I know so far:
Obviously, the .NET framework has to be installed on each workstation; I'm thinking that installing it via a Group Policy is the way to go here.
I've also read a bit about running from a network share requiring full trust, but then I read this may not be an issue in 3.5. Does anyone know the definitive answer here?
Source: (StackOverflow)
I have been trying to lock a file so that other cloned services cannot access the file. I then read the file, and then move the file when finished. The Move is allowed by using FileShare.Delete
.
However in later testing, we found that this approach does not work if we are looking at a network share. I appreciate my approach may not have been the best, but my specific question is:
Why does the below demo work against the local file, but not against the network file?
The more specific you can be the better, as I've found very little information in my searches that indicates network shares behave differently to local disks.
string sourceFile = @"C:\TestFile.txt";
string localPath = @"C:\MyLocalFolder\TestFile.txt";
string networkPath = @"\\MyMachine\MyNetworkFolder\TestFile.txt";
File.WriteAllText(sourceFile, "Test data");
if (!File.Exists(localPath))
File.Copy(sourceFile, localPath);
foreach (string path in new string[] { localPath, networkPath })
{
using (FileStream fsLock = File.Open(path, FileMode.Open, FileAccess.ReadWrite, (FileShare.Read | FileShare.Delete)))
{
string target = path + ".out";
File.Move(path, target); //This is the point of failure, when working with networkPath
if (File.Exists(target))
File.Delete(target);
}
if (!File.Exists(path))
File.Copy(sourceFile, path);
}
EDIT: It's worth mentioning that if you wish to move the file from one network share, to another network share while the lock is in place, this works. The problem only seems to occur when moving a file within the same file share while it is locked.
Source: (StackOverflow)
I emulate Windows 8 on a VM using Parallels. I store all of my developer projects on my Mac's partition for simplicity and coherence.
When I try to build an app (Visual Studio 2012) running off this network share, I get the following compile-time error:
Error 1 Error : DEP0700 : Registration of the app failed. Rejecting a request to register from file:///Z:/Users/MY_USER_NAME/Sites/App1/App1/bin/Debug/AppX/AppxManifest.xml because the files are on a network share. Copy the files to the local computer before registering the package. (0x80073cf9) App1
Does anyone know how to solve this issue? I need to tell Visual Studio 2012 that my network share is a trusted device, or at least dupe it into thinking the project is in a local drive. Is there anyway to create symbolic links in Windows?
In Visual Studio 2010, I solved this issue as outlined on this website: http://www.sehajpal.com/index.php/2010/10/how-to-solve-loadfromremotesources-error-in-vs-2010/
Thanks for the help!
Source: (StackOverflow)
I'm looking for a way to read the file contents of a file located on a network share. I can use the IP Address of the share host and the share folder to get to the location but I don't know the correct command and syntax to do that file_get_contents? fopen?
$text = fopen('//128.251.xxx.xxx/Common/sample.txt', 'r');
or something like that?
UPDATE*
I also cannot access the file through a browser window although I know the file is located in that exact directory...
Source: (StackOverflow)
I have an application which sits on a server in the network shared folder. Many users in network, can use that file simultaneously. I would like to perform an update of that EXE file and to do this, I would like to know who in network (besides me) is currently using that file.
Is it possible to check this programmatically? For example: to list all user names who are using that file now? Or atleast to retrieve number of locks on that file?
Thanks.
Source: (StackOverflow)
When I read a file from a network share it updates the creation time to the last write time. This causes me problems with System.Configuration.Configuration because it thinks the file has changed and therefore throws an exception (The configuration file has been changed by another program.). The workaround would be to set the creation time to the last write time manually beforehand. But I'd like to know whether this is a known problem.
Here is some test code:
string filePath = @"X:\SomeFile.txt";
FileInfo fileInfo = new FileInfo(filePath);
DateTime creationTimeBeforeRead = fileInfo.CreationTimeUtc;
FileStream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read);
byte[] result = new byte[fileStream.Length];
fileStream.Read(result, 0, (int)fileStream.Length);
fileStream.Close();
fileInfo.Refresh();
DateTime creationTimeAfterRead = fileInfo.CreationTimeUtc;
I have no idea if the problem lies within .net, the Windows API or on the server side. Does anyone have any insight?
Source: (StackOverflow)
I have a network shared folder mapped to a drive letter, which is accessible from Windows Explorer, from the command prompt as well as from my WinForms application without problem. It is also accessible from my Windows service using a UNC path.
However, when I attempt to access this network location using a mapped drive letter from the Windows service, access fails. The Windows service is configured to use my personal "Log On" account credentials, which is the same in all the above cases. I am an administrator.
Many customer sites utilize drive letters for network shares and I cannot always control this and force them to specify UNC paths instead. I need to be able to access network shares using drive letters from a Windows service.
What do I need to do to set up my Windows service, so that it can access network shared folders that are mapped to drive letters? My Windows service is written in C#.
Source: (StackOverflow)
I have an executable that is started by a windows service, this program will be run on a customers machine and will need to connect to a remote share to perform a particular task. This share is specified by the customer via a UI, so we do not know this in advance meaning it can't be "hard-coded", or the share mapped in advance.
Previously we required the customer to log on to their machine and run the executable on log-on , but we have always wanted to allow our program to run within a service and not require a log-in, primarily to make it easier for the customer and prevent any accidental log-outs shutting down our software. So this also means we don't know what local user accounts exist on a customers machine, so we have to start the service using the local system account.
We now have, as mentioned above, a wrapper service to start the executable and perform various tasks. This appears to work fine in most cases and accesses the underlying network fine - our software's purpose mainly involves capturing packets etc.
However, when the software tries to connect to a windows share (UNC name) it cannot connect. Whereas if the executable was started manually it connects fine.
The suggestions I have generally seen to resolve these kind of issues appear to all say use a user account as the system account cannot access network shares, but in our case this isn't possible. Is there any other way we could get this to work?
Edit: I forgot to mention that this application could (and most commonly will be) run on Win2K not XP, and I think I'm right in saying that the Local Network account is not available before XP?
Source: (StackOverflow)
I have a large number of audio files I am running through a processing algorithm to attempt to extract certain bits of data from it (ie: average volume of the entire clip). I have a number of build scripts that previously pulled the input data from a Samba network share, which I've created a network drive mapping to via net use
(ie: M: ==> \\server\share0
).
Now that I have a new massive 1TB SSD, I can store the files locally and process them very quickly. To avoid having to do a massive re-write of my processing scripts, I removed my network drive mapping, and re-created it using the localhost
host name. ie: M: ==> \\localhost\mydata
.
When I make use of such a mapping, do I risk incurring significant overhead, such as from the data having to travel through part of Windows' network stack, or does the OS use any shortcuts so it equates more-or-less to direct disk access (ie: does the machine know it's just pulling files from its own hard drive). Increased latency isn't much of a concern of mine, but maximum sustained average throughput is critical.
I ask this because I'm deciding whether or not I should modify all of my processing scripts to work with a different style for network paths.
Extra Question: Does the same apply to Linux hosts: are they smart enough to know they are pulling from a local disk?
Source: (StackOverflow)