3

When doing commands like LS I get output like this (doing so on NFS mounted remote folder)

-rw-r--r--. 1   4016 folderA        23 Mar 31 10:47 soto_file

This is perfectly correct and the file was created in another computer by a user with the ID 4016. But the computer doing ls obviously doesn't know this UID. My question is, is it possible to replace this with a string when doing ls without creating a new user? Otherwise this is very uninformative (this is something other users will have to use and they won't know which number corresponds to each user).

9
  • 3
    Usually one sets up LDAP or some other means of ensuring that all the computers share the same set of UIDs and associated accounts...
    – thrig
    Commented Mar 31, 2017 at 15:26
  • You might be right, thing is that "setting up LDAP" can take a really long time, is hard and non trivial for what essetially boils down (in the particular case of what I want) to match a number with a name. To share a file between like 10 people, at most. So I was looking for alternatives
    – aarelovich
    Commented Mar 31, 2017 at 16:00
  • Some NFS have an idmap thing that could perhaps take appropriate procrustean measures to the IDs. Does it need to be NFS, or would webdav or samba or some other protocol work?
    – thrig
    Commented Mar 31, 2017 at 16:04
  • @aarelovich The other obvious alternative is to just create the user (and do so with every user, and have them all have the same UIDs), can you explain in more detail why this isn't a viable solution for your case?
    – Random832
    Commented Mar 31, 2017 at 16:06
  • @Random832 This is totally a viable solution. But I would have to create 10 users in 10 different machines. I don't mind doing the work, I simply thought there could be a more elegant solution or that this could be a security problem. I'm really just starting on these types of issues
    – aarelovich
    Commented Mar 31, 2017 at 16:08

1 Answer 1

0

A user is identified on a running system and in most filesystems by a numerical identifier, not by a name. You can't replace the numerical identifier (the uid) by a name inside the filesystem: the ls command does that, based on the user database of the system it's running on.

Modern versions of the NFS protocol (NFSv4) allow user and group ID remapping. On the client, configure nfsidmap to map server user 4016 to whatever user you want to have locally.

If you're setting this up for many users over many machines, it's usually a lot easier to set up network-wide accounts using LDAP. This way a user has the same user ID on all machines.

If you're setting this up for just one user, it's usually a lot easier to use a different protocol than NFS. Make sure that the server is running an SSH server with SFTP enabled and mount the remote filesystem via SSHFS.

1
  • SSHFS was the first thing i tried. Problem was that it was too slow. The program that needed to work of he remote folder used up to 1 minute or more just to open and a lot of operations became very slow. This is why I started using nfs. Using LDAP is simpler only if you know what to do. And i haven't found a single tutorial or the like to guide me as I'm totally lost as to how to even start
    – aarelovich
    Commented Apr 1, 2017 at 17:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .