Welcome to the Linux Foundation Forum!

Cht 12 lab 1

Options

I do not really understand why cat /etc/passwd > appendit does not work but

cat /etc/passwd >> appendit does work

lsattr on passwd on shows the e attribute not the i immutable attribute

and why does >> work instead.

Some further explanation would be helpful.

Thanks

Comments

  • NYCJacob
    NYCJacob Posts: 19
    Options
    also in lab2 after I add the line to fstab and reboot my system goes into emergency mode and I have to remove the line to boot normally.
  • Brucecurcio
    Brucecurcio Posts: 5
    edited September 2015
    Options
    the single arrow > is redirection and just copies into the file; overwriting previous information. With the append-only attribute set, you cannot copy into the file. the double arrow >> is the append operation, which is permitted with the append-only attribute set.

    You should be setting the attributes on the appendit file not the passwd file, as this is the file that you are trying to change.

    I'm not sure what you are doing with the fstab file. If you copy its contents to the forum, perhaps someone can give you some insight.
  • luisviveropena
    Options
    NYCJacob wrote:
    also in lab2 after I add the line to fstab and reboot my system goes into emergency mode and I have to remove the line to boot normally.

    Hi NYCJacob,

    Can you provide more information on what line are you adding and how it's failing, please?

    Note: please keep one problem per post.

    Thanks,
    Luis.
  • coop
    coop Posts: 915
    Options
    If you did the loopback solution and you put the image file in /tmp, and you then rebooted on an Ubuntu system (or any distro which erases /tmp on reboot) your system will indeed
    fail big time on reboot. Try putting the image file somewhere else where it won't
    disappear.

    If you are on a distribution that does not erase /tmp on reboot, let us know more details

Categories

Upcoming Training