Help?!


Recommended Posts

what command would you use to make sure that you cannot easily delete a file called backup (which you own) without affecting other permissions?

This is a question in a lab I'm doing. I've racked my brain, I've racked Google's brain. I've tried a TON of other things, and I can't seem to figure it out... can anyone help?

Link to comment
https://www.neowin.net/forum/topic/1056948-help/
Share on other sites

have a look at chattr command

e.g : chattr +i filename.

with this command the permissions does not change and nor you can edit or delete the file unless >>>> chattr -i filename

Good command, but chattr +u backup is probably better (makes the file only undeleteable).

http://linux.about.com/od/commands/l/blcmdl1_chattr.htm

Link to comment
https://www.neowin.net/forum/topic/1056948-help/#findComment-594643080
Share on other sites

Upon closer inspection of the man page for chattr, +u would appear to be wrong:

When a file with the `u' attribute set is deleted, its contents are saved. This allows the user to ask for its undeletion.

But +i should work:

A file with the `i' attribute cannot be modified: it cannot be deleted or renamed, no link can be created to this file and no data can be written to the file. Only the superuser or a process pessessing the CAP_LINUX_IMMUTABLE capability can set or clear this attribute.
Link to comment
https://www.neowin.net/forum/topic/1056948-help/#findComment-594643230
Share on other sites

rm /bin/rm :D

But then again if you don't want to screw the system, chattr +i is the way to go.

AFAIK you must execute it as root, though, and root still can delete the file. It just prevents plain users from modifying it in any way.

You could also make the file undeletable for every user including root using SELinux, or replace rm with the safe-rm wrapper and add your backup file to the blacklist.

Link to comment
https://www.neowin.net/forum/topic/1056948-help/#findComment-594643438
Share on other sites

Correct answer is

Chmod u-w backup

That removes write permissions, but that doesn't prevent you from deleting the file, even in a regular, non-root account.


[nick@fedora16vm ~]$ touch file.txt
[nick@fedora16vm ~]$ ll file.txt
-rw-rw-r-- 1 nick nick 0 Feb 10 13:06 file.txt
[nick@fedora16vm ~]$ chmod u-w file.txt
[nick@fedora16vm ~]$ ll file.txt
-r--rw-r-- 1 nick nick 0 Feb 10 13:06 file.txt
[nick@fedora16vm ~]$ rm file.txt
rm: remove write-protected regular empty file `file.txt'? y
[nick@fedora16vm ~]$ ll file.txt
ls: cannot access file.txt: No such file or directory
[/CODE]

Edit:

/threadhijack: I'm unfamilar with the chattr, but highly interested... but I can't get it work. Any ideas? (Fedora 16)

[CODE]
[nick@fedora16vm ~]$ chattr +i file.txt
chattr: Operation not permitted while setting flags
[/CODE]

Link to comment
https://www.neowin.net/forum/topic/1056948-help/#findComment-594646092
Share on other sites

That was the answer the Professor gave me, and the program he wrote to check answers said it was correct... thus I have to accept it's wrong, even if it isn't. :s

Link to comment
https://www.neowin.net/forum/topic/1056948-help/#findComment-594646242
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Wow, imagine you dump hundreds of hours into completing things and unlocking stuff and you lose it all. Back in the day when cheats were built into games, you could at least unlock things again that way without spending hundreds of hours again. But those days are long gone for some reason as no one builds cheats into games anymore. So it's even more painful that studio that's on its 6th installment **** it up so badly.
    • Spotify finally removes the disco ball app icon in the latest update by Ivan Jenic Image: Spotify Spotify has just released an update that removes its now infamous disco ball icon. The update reverts the app icon to the familiar flat green logo after weeks of mixed reactions online. The icon arrived on May 13 as part of the company's 20th anniversary celebration and was always intended to be temporary, though Spotify only confirmed that after the backlash started. The disco ball took the internet by storm, as the reception was split. A vocal group of users called it ugly and disorienting, with some iOS users noting that the 3D glowing effect made the app look like it was stuck mid-update. On the other end, the icon picked up a following of its own. Its retro, three-dimensional look immediately stood out against the flat, minimalist aesthetic that has dominated app design for years. It even started a small movement, spawning what people started calling "discomorphism," a mashup of disco and skeuomorphism. Other brands started posting disco ball versions of their own logos, probably in an effort to ride the wave of memes that flooded the internet during late May. Spotify has had a turbulent relationship with its user base lately. Besides the disco ball icon, which certainly wasn't appreciated by everyone, the company has also received backlash for its willingness to include AI-generated music on its platform. On May 17, Spotify promised the old icon would return “in a few weeks.” And now it looks like that time has finally arrived. So, whether you liked the disco ball or it made you uncomfortable, it’s now gone for good. The next time you update the Spotify app on your phone, the old, flat-design icon will return.
    • Playground Games confirms Forza Horizon 6 save wipe bug by Taras Buria Forza Horizon 6 was launched last month to critical acclaim (check out our review here), and it became a smash hit in an instant. Now, weeks into the launch, with die-hard fans clocking hundreds of hours, Forza Horizon 6 is facing a serious issue: save wipes. After multiple complaints on Reddit and social media, the studio issued a statement. The problem with missing saves came shortly after Playground Games promised the initial batch of gameplay tweaks and improvements. Unfortunately, there seems to be no temporary fixes for those affected by unexpected save wipes. However, the studio published a new support document with a few important steps users should try. First, affected gamers should open a support ticket immediately (go here to file one) so that the support team can try recovering the lost progress by reverting to an earlier save. Playground Games says this should be done the same day the issue occurs. Meanwhile, gamers are urged not to start new play sessions or create new saves. The studio also published a few things gamers should try to avoid to prevent potential progress loss: Ensure your Gaming Services app on PC or XBOX Series X|S console is fully up to date. On XBOX Series X|S consoles, disable Quick Resume for Forza Horizon 6: To disable Forza Horizon 6 from using Quick Resume, highlight the game box art anywhere in the console experience (Home, My Games & Apps, Pins, etc) and then press the Menu button, then go to Manage game and add-ons > Quick Resume settings > Disable Quick Resume. Ensure you are online when ‘quitting’ the game. Give your saved time to sync to the cloud before powering off or switching devices. Do not force quit the game during save screens. Do not power off the device during gameplay. Always "Quit" (console) or "Exit to desktop" (PC) once you've finished your play session, ensuring the save icon is not visible when you’re closing the game. Before turning off your console, shutting down your PC, or force-closing the Steam app, give your devices or clients at least a few minutes to ensure your latest progress has been synchronized with the cloud. This will reduce the risk of progress reversions as you switch between different platforms. XBOX Series X|S consoles, Steam, and the XBOX app on PC all include game save indicators that confirm your progress has been synced. You can read more about the bug in the official support document here. Forza Horizon 6 is currently available on PC (Steam and the Microsoft Store), Xbox Series X|S, and Game Pass. The game is also coming to PlayStation 5 later this year.
  • Recent Achievements

    • One Year In
      slackerzz earned a badge
      One Year In
    • One Year In
      highriskpaym earned a badge
      One Year In
    • One Month Later
      highriskpaym earned a badge
      One Month Later
    • Week One Done
      highriskpaym earned a badge
      Week One Done
    • Week One Done
      FBSPL earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      518
    2. 2
      PsYcHoKiLLa
      199
    3. 3
      +Edouard
      157
    4. 4
      Steven P.
      84
    5. 5
      ATLien_0
      75
  • Tell a friend

    Love Neowin? Tell a friend!