Help!! Is there a way to restore/reset permissions to default?
Thanks a million in advance for any help!
I managed to mess the permissions pretty badly (all of it, I think) when recovering files from an external drive, now I am wondering if it's possible to reset them to default (Trisquel 10).
The whole thing went south, it seems this was a true donkey move!
Here is what I've got myself into, please refrain from laughing too loudly :)
NAME SIZE OWNER GROUP MODE
sda 465.8G root disk brw-rw----
├─sda1 1M root disk brw-rw----
├─sda2 513M root disk brw-rw----
├─sda3 732M root disk brw-rw----
└─sda4 464.6G root disk brw-rw----
└─sda4_crypt 464.5G root disk brw-rw----
├─vgtrisquel-root 18.6G root disk brw-rw----
├─vgtrisquel-swap_1 1.9G root disk brw-rw----
└─vgtrisquel-home 444G root disk brw-rw----
The owner is 'disk'... ?!?
Should I add any other info that might help to make sense of this? The learning curve is very exciting, but can lead to unknown territory with shocking speed!
... I mean, the group is 'disk'... it is 1:59 AM here, on my panel rich of clocks!
When I enter command lsblk -m
the output is similar root disk brw-rw----
seems to be the default group for disk devices. Read manual page for chown command if you want to know how to change ownership on files
man chown
Are there any problems with your disks? Or you just noticed the disk group and decided something went wrong?
You can list all groups on your computer with this command
cut -d: -f1 /etc/group | sort
Same thing here. To read about system groups (but that is not required), https://wiki.debian.org/SystemGroups#Other_System_Groups is a starting point. About security implications, it starts with:
The group disk can be very dangerous, since hard drives in /dev/sd* and /dev/hd* can be read and written bypassing any file system and any partition, allowing a normal user to disclose, alter and destroy both the partitions and the data of such drives without root privileges. Users should never belong to this group.
You can list the groups you are a member of by executing that in a terminal:
$ groups
disk should not be listed.
That is great! Big smiling thanks Magic Banana!!
You and Hikaru touched on something very important there, the quackers that took control of my computer were everywhere, in all drives, reason I wanted to take ownership and take their permissions away myself, cut them off for the pleasure as well as the privacy and freedom. Gparted would not do it, so terminal was the way to go.
I still have one folder of music to copy and was wondering if that would be taking a chance.
I will check the groups straight away, that is something I've been wanting to do, but didn't know how yet. It would also be great to learn which groups we should be in or out of... more learning on the way :)
By the way, I am working to turn my Trisquel into a standalone fortress... getting there :)
What I said to Hikaru about sharing 432 Hz music goes to you too, just ask and it will be done!
Change ownership of any file with sudo and chown like
id
sudo chown -R hikaru:hikaru folder
sudo chown hikaru:hikaru file
Use your user and group instead of hikaru, -R is recursive : all files and folders in the folder.
I read you next message and found the solution brilliant!
Just one question regarding chown, can it be used for disks as well? I have been curious about that.
root is a "super user" on a GNU/Linux system, when you use sudo, you are running commands as user root. Disks are called block devices and are owned by root, belong to group disks.
You need to mount the partition from disk : /dev/sdb2 : sdb is a block device (disk), 2 is partition number. Then you can use chown inside the partition.
No need to change ownership of the whole disk device : only of files on the partition.
Hi Hikaru!!
I wondered about that, if I was misreading the info. Huge big smiling thanks for explaining it and adding such enlightening information.
I was dealing with one of the hacked drives, oops, quacked drives, so my brain was in angry/paranoid/self-protective/eager mode (to keep it short)... I guess I was also in over-confident mode in the terminal.
When I noticed those permissions I wondered if I should have been more careful... so glad it isn't as bad as I thought when I was writing last night.
Oh well, learning in dangerous setups is even more fun... and donkey mode is also very nice :)
I think my permissions need checking out anyway, so having these new commands and reference information to read is another gift from you - thank you again!
One thing that got me was that the drive I was rescuing my stuff from gave me no access, so I tried to change ownership quite a few times, then permissions... it kind of worked and I copied my 432 Hz music to my Trisquel, so happy, but I'm still not sure how to take total control over external drives, I'll be dealing with more important drives later... am taking my time because I want to be the one that does it, if not, others would have to go ahead, but I am adamant I will get there and have been studying like a mad woman.
If you would like to hear songs or albums in 432 Hz, please let me know, if I have it in my collection it would be a pleasure to share it with you!
You're welcome!
Ownership of file (folder and everything else is also a file in GNU/Linux systems) is User and Group. Permissions are Read, Write and Execute for User, Group and Others.
-rwxr-xr-- is
- it is a regular file
first 3 letters rwx : User can Read, Write, Execute
second 2 letters r-x : Group members can Read, Execute
third 3 letters r-- : Others can only Read
For folder (real name is directory) Execute means you can search in there : drwxr-xr-x : d means "directory file", Group and Others can search in directory because of x
How to change those : man chmod
If you create a folder in you home directory
mkdir my_mount
and mount your drive to that folder with appropriate command, you will have all the permissions you need. Command can be
sudo mount /dev/sdb2 ~/my_mount
Then just go to your home folder with graphical file explorer and open my_mount folder. Unmount the drive
sudo umount ~/my_mount
Is umount without letter m unlike unmount word
Thank You for the offer but I have all I need on my CD music collection!
This is wonderful Hikaru!!
The drive tends to mount itself (in /media), so I would have to unmount it first, then run the command to mount it in my new directory, is that correct? If so, how to unmount it in terminal?
In case my permissions are messed up, which permissions would you use to make it secure?
Or would this command be all it's needed to keep the folder secure?
sudo chown -R sunny:sunny my_superfolder
If we use our name when installing Trisquel (encrypted), but use a nickname for our user, does that command require the name too (instead of nickname)? Or the user is the name?
Sorry for so many questions... I've been using commands, but it still feels like speaking a new language, when we can make ourselves understood, but are unsure of adverbs, adjectives, how the to conjugate verbs, etc, etc :)
It's been a life's journey moving to GNU/Linux... thanks for the people in this great forum... and to the quackers, who unwittingly gave me wings!
-----
EDIT: Just saw the command to unmount, still over excite to solve this, sorry!
If disk is automatically mounted in /media, or you mount it by double-clicking the disk icon on desktop, then you don't need to remount it at different location, you have the read/write permissions. Still you can do it
sudo umount /media/sunny/partition_name
Where partition_name is the name of partition you have mounted (folder name).
Permissions for folders: drwxr-xr-x, set by command
chmod 755 folder_name
Permissions for files: -rw-r--r--, set by command
chmod 644 file
If a file need to be executable, because it is your script you wrote in sh language, the command for that file
chmod 744 file
or if you want to be the only one who can read the executable file
chmod 700 file
You are your user, run commands
whoami
id
uid=1000(sunny) : your user is sunny, it's number is 1000
gid=1000(sunny) : your group is sunny, it's number is 1000
Encrypted setup is a complete different thing.
It is essential to learn command find. There is graphical counterpart for finding files catfish, it is very convenient, but you still need to learn find.
man find
sudo apt install catfish
man catfish
Using find command you can change ownership like so:
if you are in the folder where your my_superfolder resides.
find my_superfolder -exec chown sunny:sunny '{}' \;
Then change permissions with these 2 commands
find my_superfolder -type d -exec chmod 755 '{}' \;
find my_superfolder -type f -exec chmod 644 '{}' \;
When using sudo do not accidentally change root ownership for your own, if you mount a disk with root files on it : you no want system files to change ownership from root to sunny.
And it is VERY important to always read manual about command before you run it. You do not really want to run in the Terminal a command that a stranger from the Internet told you to run? If somebody tells you to run du -h folder to see the disk usage, FIRST thing you do is man du
I can't thank you enough for taking time and come to the rescue Hikaru! I didn't think it was possible, but you make this place an even better place!
You explained it so clearly and completely, I think if you were to write a Trisquel guide (or GNU/Linux guide) for beginners, it would be a big hit, your ability to make the difficult accessible is so needed... if you ever want to do it and would like a guinea pig to test and give you feed back, you can count on me!
And it is VERY important to always read manual about command before you run it. You do not really want to run in the Terminal a command that a stranger from the Internet told you to run?
Thanks for this too, you are right! At first the man pages looked impenetrable, but I am beginning to love them... I was exploring them just now and can see that I am now ready to learn from them too!
I'm happy to help.
When I first start using GNU/Linux, I asked a question about how to restore deleted files on some other "linux" forum. A stranger told me to open terminal and run "find -delete". That command deleted everything in my home folder, because find without directives about what to find will just find everything and -delete is a directive to delete what was found, no confirmation asked by find command. After that incident I started to be paranoid about commands I run and always read man pages before I do so.
English is not my native language and I am still learning GNU/Linux, it is too early to write guides : I may be wrong about many things. I have a lot to learn in near future, here is 645 megabytes of what I will learn, you will find it very interesting too (link expires in 30 hours)
https://upload.disroot.org/r/kPQSMP0m#9AGN6GyxDJkKTwwQxOTPZYWagc03Mm0OU2hqMpJ8d3Y=
I had missed this message, glad I found it when I was saving the thread for offline reference.
You are very kind and generous! It must have been hell to lose everything because someone 'helped' you - the command the stranger gave you sounds like a weapon! The good thing is that you turned a bad experience into inspiration to do the opposite! That was truly inspired and must have helped you in the long run!
Yes, I understand where you are coming from about the idea of writing a guide, in every sense. The interesting thing is that I thought of doing it myself, not now, of course, although at the same time I kept thinking that I will never speak "newbie" again like I do now, the more we learn, the less we know and the more we forget how things were when we started :)
Thank you very much for the link, I'll get it now, you are so kind!
You're welcome!
Most dangerous commands to look out are
rm *
rm -rf
dd
find -delete
You may want to use rm -i instead of just rm when deleting files, -i flag will force rm to ask you about removal of each file.
You may want to use rm -i instead of just rm when deleting files, -i flag will force rm to ask you about removal of each file.
Idem for mv, cp or ln. ;-)
Yes, thank you for that Magic Banana!
I would love to have that empathic "-i" working on everything, as terminal default empathy... is there a way to achieve that?
Sure. Add those lines in ~/.bash_aliases (I assume you use GNU Bash, Trisquel's default shell):
alias cp='cp -i'
alias ln='ln -i'
alias mv='mv -i'
alias rm='rm -i'
It's easy to forget that you have those aliases on different machines, some day accident may happen when user expect rm to act as rm -i, but there is no alias on that computer. Maybe it better to use arm instead of rm to always remind yourself?
alias acp='cp -i'
alias aln='ln -i'
alias amv='mv -i'
alias arm='rm -i'
"a" : short for "ask"
Oh wow, that is cool!
Thank you Magic Banana, looks good and although I get the gist, I am not sure how to apply :)
I assume you use GNU Bash, Trisquel's default shell
Not quite there yet, but would love to find out more and put this to work.
Open Pluma text editor, put in the lines of code with aliases, save as .bash_aliases in your home folder.
Oh, that sounds very doable, thank you!!!!!
GNU Bash is now on my forever growing list of exciting things to learn!
There is a reference manual online
https://www.gnu.org/software/bash/manual/bash.html
And page 133 in Ubuntu Bible book
Great, link bookmarked!
I'll be checking the Ubunto Bible too, it's wonderful to have that book, thank you again for sharing!! I also like the way you catalogue your books, very thoughtful!
What a beautiful "-i"
There it's!... I have been asking myself that question - confirmation?!? how can I get confirmation?... and there you are, THANK YOU Hikaru!
Now, about progress on the rescue mission. I was at it all day yesterday and feel so proud of myself, such a good feeling when we get the results we worked for - with more smiling thanks for that too!
I've copied all my music to Trisquel, so was able to delete the quacked drive and reformat it for work and play storage... the play part has started with copying the big music directory back to the reformatted drive, so there is no need to add that huge folder (148GB+) to BackInTime backups, which is a big time saver.... the work part could be a little more complicated, but I want and will to do it myself, no matter how long it takes to get it done (this is a mega stimulus to learn, so the longer, the better :)
Oh... I had to delete hundreds of of those invisible files the fruit adds to every folder (.DS_Store), as I thought those files could cause problems... I deleted them all BY HAND, one by one, because I always felt open to errors when deleting files in terminal.... haha, now I can, next time I'll be using the helpful "-i"!
One more thing to let you know, I couldn't get the mount folder to work (the disk wouldn't mount there). I ended up having to to do it from the default directory, /media/sunny/... I checked the permissions and I am not the owner of that directory, wonder if that is as it should be... this drive really needed caging, the first thing it wanted to do, was to connect via samba (tried 3 times in vain :)... no way Jose, I was prepared and was nice to see it failing so badly (on system logs info), all its 3 dodgy 3 partitions! Well, I reformatted it and am now the owner, as it should be.
I must say one more thank you, I downloaded the books! WOW!!!!! Can't wait to start on them!
You're welcome!
When drive is automatically mounted, /media/sunny is owned by root, the contents are accessible to your user.
Run find command with echo, it will say what will be done:
find folder_name/ -type f -name '.DS_Store' -exec echo rm '{}' \;
If it is exactly what you want to happen, run it without echo:
find folder_name/ -type f -name '.DS_Store' -exec rm '{}' \;
Where folder_name is your folder, rm is a command to remove, you can even use rm -i to make it ask you about every file, answer letter y and press enter.
find folder_name/ -type f -name '.DS_Store' -exec rm -i '{}' \;
rm -i, cp -i, mv -i : all the commands I'm aware of to use confirmations when -i is present.
You can use full folder path from any location, for example
find /media/sunny/folder_name/ -type f -name '.DS_Store' -exec rm -i '{}' \;
Leaning how to use find command is very important
info find
man find
About mounting, if the disk containing the Apple file system, it should be mounter by appropriate command instead of just mount. Operating system automatically uses proper command when auto-mounting. I remember there was the command in your previous thread on these forums : https://trisquel.info/en/forum/converting-old-machine-gnulinux-fruit-freedom#comment-171080
fpafsmount - you need to read the man page about it's command line.
It's hard to learn without books, I love reading books!
The find command seems extremely useful. I definitely have to study it!
About mounting, if the disk containing the Apple file system, it should be mounter by appropriate command instead of just mount. Operating system automatically uses proper command when auto-mounting. I remember there was the command in your previous thread on these forums : https://trisquel.info/en/forum/converting-old-machine-gnulinux-fruit-freedom#comment-171080
fpafsmount - you need to read the man page about it's command line.
Aha!!! That makes more sense now, I will re-read it all... there is a jumble of new knowledge in my head and I need to sort it all out - thank you for remembering that info and linking it!
I had to delete hundreds of of those invisible files the fruit adds to every folder (.DS_Store), as I thought those files could cause problems... I deleted them all BY HAND, one by one, because I always felt open to errors when deleting files in terminal.... haha, now I can, next time I'll be using the helpful "-i"!
Computers are great to automate boring repetitive tasks. And they are better than us at those tasks. So, if I were you, I would use one single find command. That should do it (but it is a good idea to first run in without -delete and see if every listed file is indeed to be deleted):
$ find . -name .DS_Store -delete
EDIT: Hikaru was faster; I do not think his find commands need to be that complicated though. :-)
Brilliant Magic Banana, I will put both here, so I'll never forget to run BOTH:
Make sure...
find . -name .DS_Store
Then zapp them... :)
find . -name .DS_Store -delete
I'll start with checking how many of those I missed - Thank you!
I will never speak "newbie" again like I do now, the more we learn, the less we know and the more we forget how things were when we started :)
Indeed. That is something many professors tend to forget. (I am a professor.)
Hikaru and you should not be afraid to start contributing to Trisquel's documentation.
That is warmly encouraging Magic Banana!
I guess an editor (a professor?) to overlook the material could be a nice way to go... confidence tends to come a bit too late for us mere mortals to remember the growing pains that others could well be going through :)
At first the man pages looked impenetrable
They are usually more specifications than manuals. Here, Hikaru and you only discuss GNU commands. For those, info provides better information to learn than man. For instance:
$ info chown
That is so helpful Hikaru!
I feel confident now to plug the drive and continue (just saw your next answer and it completes it!)
What I've learnt today will help with all my main drives, where my work of more than a decade is stored. I just have to get myself an USB caddy for them, I think I am ready!
THANK YOU!
About the music
It is not what we are used to... moving from 440 Hz to 432 Hz is like leaving windoze or macoze behind for GNU/Linux!
It is an amazing change worthy of a free brain.
The info on the web is pretty confusing, there is a lot of junk on the subject, like in all subjects, so don't go by what you read, it takes researching and experiencing the outcome for ourselves.
Music is a personal thing, I'm more into books. Looking to buy Sudo Mastery, 2nd Edition, a book explaining in detail how sudo works.
https://mwl.io/nonfiction/tools#sudo2
First time I will buy from this author, online version in PDF, do not really want to touch Amazon and not sure if other options are available for my region. Do not have time to read the book at the moment anyway, will get it for sure in some distant future : sudo is very important to learn about.
Agree 100%! You are doing the 'do' that a super-user means to do :)
Thanks for the link to the book as well, it is great to hear you went directly to the author. I'll give myself a little more learning time to appreciate it and think I'll have a go... like you, I never ever touch amazon, cut them off a few years ago and never looked back. I like PDFs too, and audio books, specially when the are well read. Here is one I am 'reading':
https://odysee.com/@DigitalAlexandria:5/Aristotle---Metaphysics:7
There is a good selection there, searching for Aristotle brought up quite a few:
https://odysee.com/@DigitalAlexandria:5?view=content
As for the music, there is nothing to think of it, I just wanted to make sure you knew you were welcome to ask, if you were so inclined.
All the new-age stuffs about 432 Hz are crap!
The A's frequency is just a convention made to be able to play with different instrumentists, the only interest is for capability of the instruments regarding this or that composition in this or that key, especially for the vocalist that might not be able to reach the higher(s) note(s) or the lower one(s), in that scenario, there are two solution: changing the key or changing the A frequency (that is just a different way to achieve the same thing). For some other instrument, the string tension (or any of such physical limits or playing comfort considerations) might be considered regarding the frequencies used and so the A frequency (or the key used).
Johannes Chrysostomus Wolfgangus Theophilus Mozart used a 422 Hz A. Bagpipes traditionaly have a A that is in between 460 Hz and 470 Hz (if I remember correctly).
And last argument, i might be 431 Hz or 433 Hz, whatever the instrument, you might hear the difference, but you wouldn't notice any difference in any other fields (playing or singing comfort, shakra balancing my dancing ass and so on). But, 432 is a number with a downward sequence of ciphers from 4 to 2, so, it's easy to write, how cool is that? Well, I find no interest in it but believers to new-age concepts might find this number more “mystic” because of that, who knows…
For more information, I suggest you the following wikipedia pages:
I tend to think that the kind of temperament used is much more important then the actual A frequency.
I had to smile... that is 'old age', not 'new-age' at all. I agree with you, new-age is crap at its crappiest!
As I said to Hikaru, the web is littered with junk info about it, but I also realise it's not easy to differentiate at the beginning, only time tells you if it is better or not. I must say I can't listen to music in the standard frequency any more, it irritates me in the long run (long run being the key words)... but it is not an obvious thing, of course, we have to tune our ears as well.
Also, it's known that many musicians prefer it. Pink Floyd, for example, gave their Albert Hall concerts with instruments tuned to 432 Hz and while converting their albums, I usually found at least 10% were already at that frequency (maybe 10% is all they can get away with)... and they are not alone, there were many others who also sneaked some 432 Hz in, even heavy metal bands had some included.
Anyway, this is not Trisquel talk, so I'll refrain from going on :)
I personally have no problem being off-topic.
So, what I perceive, and you are far to be the only one, is something related to the perfect pitch syndrome, just with a 432 Hz A, you know those boring people who yell about note(s) not being in pitch, but if you dig a little bit, that means that their hear is so used to standard 440 Hz A pitch (and also in a bunch of standard scales and modes) that if the all is not what is intended but perfectly in pitch, they will still yell to you that you are not in pitch. It's the same with lots of 432 Hz fans, the more they are fan, the more they are used to it and the more they can't stand anything else anymore while, about pitch, all should be relative because all is naturally relative.
For example (of this relativity) a choir (so a group of people only singing, with no instruments) will begin at a certain A and have great chance (it depends on the composition) to finish with another A because their mind do perfect and most of all just fifth, third and so on that makes the pitch derivative (mathematically except if the composition is made so that it resolves mathematically to the initial state, but I don't think any compositor would loose his time to do that, but theoretically, that's possible and even not really hard to achieve).
But if a choir team up with an ensemble (who's instruments are limited to a certain A pitch), the choir will follow the instruments with continuous micro-adjustments they won't even think about, nowadays (and since quite a few centuries), most instruments are in equal temperament that is even less natural then just temperament, so signers are a lot more used to those micro-adjustments because of the added constrains that is equal temperament.
So, to summertime, the perfect pitch syndrome is unnatural and really new-age (even though not tied to the religion of that name that, yes, began to age).
If you play any instrument, just try, let's say 429 Hz or 435 Hz, it will be slightly different and on the long run, you will find it perfect, but this is not tie at all to the chosen pitch, no pitch is better then another, it's tied to the conformation to an habit.
My own voice makes that I'm closer to Johannes Chrysostomus Wolfgangus Theophilus Mozart's A pitch, but I wouldn't choose his A pitch specifically because this would mean conform to something existing, I would chose arbitrarily* something close and non-existing because art is about expressing once personality in any possible way.
*: because, frankly, from a voice's perspective, a few Hertz do not change anything, maybe something like 5 Hertz might do a slight difference concerning the ability to do certain notes close to one's voice's own limits.
Thank you for giving time to this... you made me smile again!
In art, a tiny winy Hz can be the difference between the sublime and the derivative... (I am an artist, by the way, the kind that paints :)