LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-20-2024, 10:42 AM   #1
maybeJosiah
Member
 
Registered: Jan 2024
Location: USA
Distribution: Ubuntu, Android, Ubuntu Touch, Jolla Sailfish maybe
Posts: 235
Blog Entries: 2

Rep: Reputation: 5
Exclamation Bash, maximum file/folder listing, ls -a? Why no /run/5000/?


In Bash I have a thing that recursively goes into directories and calls "ls -a" to find all in it until no more are like found. I seem to have something like "/run/5000/" folder with "find" command that I tried saying it exists but it never showed in like my recording with "ls -a" and I know it exists and I ran it as sudo with no errors and according to that program no unfound directories or files. Is there another better way to do this or am I stuck with "ls -a"? Is there some super-root or what? "ls -a" seems like it should work. I know there may be permission denied, with "find" at least. I am on Ubuntu desktop 22.04.3 LTS but trying for on all ext2 to ext4 Linux for like my program set. I just want it to list all files and folders in all directories it is called. If it helps, I was running on / directory like "sudo ./myProgramXE.sh /". Do I maybe need in that "sudo ls -a" inside like my program? Basic problem: no access to "/run/5000/" and inside it even as sudo, "ls -a" seems to not list it and "find" permission denied both as sudo. Like my program records timestamps, inode, and what path. It also displays path in terminal as going. No that directory displayed or recorded. What should I try? This seems like a bug to me so should I report it as such? X E.
 
Old 01-20-2024, 10:56 AM   #2
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,880
Blog Entries: 1

Rep: Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871
TL;DR
Please quote the command/script you have problem with.
 
Old 01-20-2024, 10:56 AM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,781

Rep: Reputation: 5935Reputation: 5935Reputation: 5935Reputation: 5935Reputation: 5935Reputation: 5935Reputation: 5935Reputation: 5935Reputation: 5935Reputation: 5935Reputation: 5935
/run and anything within is usually a tmpfs filesystem which only exists in memory. If you are only trying for ext2,3,4 filesystems then don't include temporary filesystems.

I would guess the actual path is /run/user/<user id> which only has user permissions (drwx --- ---) and so running with sudo you should see a permission denied warning.

Last edited by michaelk; 01-20-2024 at 11:04 AM.
 
1 members found this post helpful.
Old 01-20-2024, 11:18 AM   #4
maybeJosiah
Member
 
Registered: Jan 2024
Location: USA
Distribution: Ubuntu, Android, Ubuntu Touch, Jolla Sailfish maybe
Posts: 235

Original Poster
Blog Entries: 2

Rep: Reputation: 5
I am certain it was "/run/5000/" and it shows all times when I use "find" as permission denied. With "ls -a" recursively it is never listed but I know it exists. X E.
 
Old 01-20-2024, 11:21 AM   #5
maybeJosiah
Member
 
Registered: Jan 2024
Location: USA
Distribution: Ubuntu, Android, Ubuntu Touch, Jolla Sailfish maybe
Posts: 235

Original Poster
Blog Entries: 2

Rep: Reputation: 5
Do you want code or what? All you should need is that "ls -a" never lists it and "find" cannot access it and I would like all things on this computer listed. Programs are run like "sudo ./program.sh /". I do not use sudo inside programs. X E.

Last edited by maybeJosiah; 01-20-2024 at 11:24 AM. Reason: sudo maybe
 
Old 01-20-2024, 11:29 AM   #6
maybeJosiah
Member
 
Registered: Jan 2024
Location: USA
Distribution: Ubuntu, Android, Ubuntu Touch, Jolla Sailfish maybe
Posts: 235

Original Poster
Blog Entries: 2

Rep: Reputation: 5
while IFS= read -r line; do
...
done < <(ls -a "$1")

Something like that is in like my code in a function with 3 arguments. X E.
 
Old 01-20-2024, 11:37 AM   #7
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,880
Blog Entries: 1

Rep: Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871
Please forget "something like this". Quote the actual command/script and clearly describe your problem/question.
A fun fact: /run is a product of Lennart Pöttering. It is a temporary storage, its content is volatile.
 
Old 01-20-2024, 11:39 AM   #8
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,747

Rep: Reputation: 7982Reputation: 7982Reputation: 7982Reputation: 7982Reputation: 7982Reputation: 7982Reputation: 7982Reputation: 7982Reputation: 7982Reputation: 7982Reputation: 7982
Quote:
Originally Posted by maybeJosiah View Post
Do you want code or what? All you should need is that "ls -a" never lists it and "find" cannot access it and I would like all things on this computer listed. Programs are run like "sudo ./program.sh /". I do not use sudo inside programs. X E.
No, don't think we need code, since this topic (like most of your others) seem to stem from these:
https://www.linuxquestions.org/quest...be-4175732528/
https://www.linuxquestions.org/quest...ps-4175732544/

For someone who started out by saying you're "like advanced Linux user and programmer.", you seem to be ignoring everything you're being told and don't seem to understand the answers you get. There aren't any 'bugs' to report in your original post in this thread, and again..you *DO NOT NEED* timestamps/ctime/mtime/whatever-time to do a system restore. If you don't understand that the file *IS* the data, and the time on it doesn't matter...there isn't much we can do to help you. If I back up a file with my Apache configuration (which is plain text), and I open it, insert a single space/comment and save it, then REMOVE my edits and save it again, the files timestamps are totally different, but the DATA is the same. When I go to start Apache, do you honestly think it's going to error out because of a timestamp?? No, it doesn't....nor does anything else.

Again, if you back up your config files and your /home folder (along with whatever else you edit/add/think good), you're done. That's it...really. No one wants or needs a program that looks at timestamps for backups, because they're useless. True backup programs that do versioning already keep track of these things, which lets you have many copies of the same file at different times/dates, so you can roll back if needed.

As myself and other experienced admins have told you (and we have DECADES of experience to draw upon, in the real world), what you're doing is pointless. Reload the operating system, and copy your data back from your backup set. Simple. I have restored servers with multiple RAID/SAN disks attached to them in 20 minutes before with zero problems. If you need something for data-security purposes to keep track of file changes, those exist but *NOT* for backups because they're not needed.

Be clear: what is the EXACT PROBLEM you're trying to solve with all this???
 
Old 01-20-2024, 11:39 AM   #9
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,781

Rep: Reputation: 5935Reputation: 5935Reputation: 5935Reputation: 5935Reputation: 5935Reputation: 5935Reputation: 5935Reputation: 5935Reputation: 5935Reputation: 5935Reputation: 5935
Post a screenshot.

If the permissions of the directory are user user drwx------ then root i.e. running with sudo can not list the contents.
 
Old 01-20-2024, 11:43 AM   #10
maybeJosiah
Member
 
Registered: Jan 2024
Location: USA
Distribution: Ubuntu, Android, Ubuntu Touch, Jolla Sailfish maybe
Posts: 235

Original Poster
Blog Entries: 2

Rep: Reputation: 5
Just to be clear @michaelk, I should post a screenshot of stat or something? Or did you want "ls -a"?
 
Old 01-20-2024, 11:45 AM   #11
maybeJosiah
Member
 
Registered: Jan 2024
Location: USA
Distribution: Ubuntu, Android, Ubuntu Touch, Jolla Sailfish maybe
Posts: 235

Original Poster
Blog Entries: 2

Rep: Reputation: 5
@Tb0ne, #4 should state the problem in its entirety that I am trying to solve. X E.
 
Old 01-20-2024, 11:50 AM   #12
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,781

Rep: Reputation: 5935Reputation: 5935Reputation: 5935Reputation: 5935Reputation: 5935Reputation: 5935Reputation: 5935Reputation: 5935Reputation: 5935Reputation: 5935Reputation: 5935
I want a screen shot or copy/paste for the output of:

ls -ld /run/5000 (Use the exact path)

Again this is a temporary filesystem that exists only in memory.

Last edited by michaelk; 01-20-2024 at 11:55 AM.
 
Old 01-20-2024, 11:58 AM   #13
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,880
Blog Entries: 1

Rep: Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871
If you are interested in "process isolation" read these:
https://en.wikipedia.org/wiki/Cgroups
https://en.wikipedia.org/wiki/Linux_namespaces
Things like this are used by containerization.

Last edited by NevemTeve; 01-20-2024 at 12:02 PM.
 
Old 01-20-2024, 12:16 PM   #14
maybeJosiah
Member
 
Registered: Jan 2024
Location: USA
Distribution: Ubuntu, Android, Ubuntu Touch, Jolla Sailfish maybe
Posts: 235

Original Poster
Blog Entries: 2

Rep: Reputation: 5
norvel@norvel4-ThinkPad-T460:~$ sudo ls -ld /run/5000
[sudo] password for norvel:
Sorry, try again.
[sudo] password for norvel:
ls: cannot access '/run/5000': No such file or directory
norvel@norvel4-ThinkPad-T460:~$
 
Old 01-20-2024, 12:17 PM   #15
maybeJosiah
Member
 
Registered: Jan 2024
Location: USA
Distribution: Ubuntu, Android, Ubuntu Touch, Jolla Sailfish maybe
Posts: 235

Original Poster
Blog Entries: 2

Rep: Reputation: 5
norvel@norvel4-ThinkPad-T460:~$ sudo ls -a /run/
. dmeventd-server qemu
.. dnsmasq sendsigs.omit.d
acpid.pid drweb-configd.pid shm
acpid.socket gdm3 snapd
alsa gdm3.pid snapd-snap.socket
avahi-daemon initctl snapd.socket
blkid initramfs speech-dispatcher
.com.drweb.admin irqbalance spice-vdagentd
.com.drweb.fcheck libvirt sudo
.com.drweb.gated libvirtd.pid systemd
.com.drweb.ncheck lock thermald
.com.drweb.public log tmpfiles.d
.com.drweb.se lvm ubuntu-advantage
.com.drweb.urlcheck motd.d udev
console-setup mount udisks2
credentials netns unattended-upgrades.lock
crond.pid NetworkManager user
crond.reboot openvpn utmp
cups openvpn-client uuidd
dbus openvpn-server wpa_supplicant
dmeventd-client plymouth xtables.lock
norvel@norvel4-ThinkPad-T460:~$
 
  


Reply

Tags
bash, find, finding, permission denied, timestamp



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] maximum filename lenth and maximum file size snjksh Linux - Newbie 5 07-22-2013 12:34 AM
sftp ls command, short listing vs long listing slufoot80 Linux - General 3 02-05-2013 10:40 AM
I don't understand this line ->>> delay_parameters 2 5000/150000 5000/120000 manalisharmabe Linux - Newbie 6 05-17-2011 06:27 AM
[SOLVED] BASH: limit a .tar.gz to a maximum file size worm5252 Programming 8 04-09-2010 05:14 AM
Bash script for listing FTP usage as the file name of a file created in each share jojothedogboy Programming 1 12-05-2008 03:35 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration