0

I have just upgraded an Ubuntu server and during the upgrade, I decided to keep all old versions of .conf files instead of replacing them with the upgraded package versions. Now, I have to go and manually merge the new files (*.conf.dpkg-dist) with the original files (*.conf). My strategy to do so was to mount the servers root filesystem via SFTP on my local Mac and use a MacOS Gui Visual Diff merger tool like Meld to merge the old files with the new files directly on MacOS.

This sounds great in concept, but the problem is, that when I SFTP into my server on my Mac, I am only able to navigate directory's above the login users home directory, preventing me from accessing any files or folder in / such as the /etc folder. In other words, if I sftp login as "my-non-root-user-with-sudo-privilages", I can only access /home/my-non-root-user-with-sudo-privilages/* directory and above. I cannot access just /home or /etc.

Same case goes if I log in as "root" with sftp. I can only see the /root/* directory and any directory/file above /root/ but not below it. So again, logging in as "root" gives me access to everything in the /root folder and above, but I cannot go down to the / directory or navigate to the /etc directory even as root user.

My question is, (on macos) when SFTP logging into an Ubuntu Server as either "my-non-root-user-with-sudo-privilages" or "root", how can I navigate to restricted directories below the corresponding user's home folders, such as the /etc folder?

1 Answer 1

0

That is how an [S]FTP server works. By default, an [S]FTP server will, when you log in as user, start you in user's home directory, and that will be your root directory for the entire session. This is a security measure to keep random users from logging into FTP and snooping through your system.

You can create a custom FTP user who has access starting at /, but that has to be done server side, and I don't need to tell you that it's a security risk.

4
  • How exactly would i create a user on Ubuntu that starts at / on the server? It would only be temporary so im not worried about security. Commented Oct 21, 2023 at 13:08
  • That would depend on what FTP server you have on your Ubuntu machine. And I don't think you've given us that information. Commented Oct 21, 2023 at 16:19
  • im just using the sftp program that comes natively with openssh and is listed in sshd_config at the bottom. How do i figure out what that is? Commented Nov 12, 2023 at 19:01
  • sshd actually uses the Linux user list. So what you would do is create a new Linux user and set their home directory to /. Be sure that user is included in the ssh group so they have the permission they need. Commented Nov 13, 2023 at 1:54

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.