No spamblog submissions - Posts that are identified as either blog-spam, a link aggregator, or an otherwise low-effort website are to be removed.

No memes, image macros or rage comics - Meme posts are not allowed in r/linux. Feel free to post over at /r/linuxmemes instead.

Reddiquette, trolling, or poor discussion - r/linux asks all users follow Reddiquette. Top violations of this rule are trolling, starting a flamewar, or not "remembering the human" aka being hostile or incredibly impolite.

Relevance to r/linux community - Posts should follow what the community likes: GNU/Linux, Linux kernel itself, the developers of the kernel or open source applications, any application on Linux, and more. Take some time to get the feel of the subreddit if you're not sure!

Spamming self-promotion and surveys - Submitting your own original content is welcome on r/linux, but we do ask that you contribute more than just your own content to the subreddit as well as require you to interact with the comments of your submission. Additionally, surveys are not allowed.

No misdirecting links, sites that require a login, or URL shorteners - In short: if your link doesn't go right to the content it will be removed.

GNU/Linux is a free and open source software operating system for computers. The operating system is a collection of the basic instructions that tell the electronic parts of the computer what to do and how to work. Free, Libre and open source software (FLOSS) means that everyone has the freedom to use it, see how it works, and change it.

GNU/Linux is a collaborative effort between the GNU project, formed in 1983 to develop the GNU operating system and the development team of Linux, a kernel. Initially Linux was intended to develop into an operating system of its own, but these plans were shelved somewhere along the way.

Linux is also used without GNU in embedded systems, mobile phones and appliances, often with BusyBox or other such embedded tools.

So another question - isn't this ability for bash to essentially execute any shared object a security issue? Say my user has sudo permission to only run bash, then I can "enable -f" it to do run else I want to from within bash.

You could probably argue that if I can run bash as root then I gave up any security I might have had, but still...

Unquoted here documents are subject to bash parameter expansion, command substitution, arithmetic expansion, the character sequence \newline is ignored, and \ must be used to quote characters such as \ $ `. Hence you have no guarantee that the right contents will end up in setx.c.

I want the contents of setx.c to be exactly bit by bit perfect to the original code that I wrote. So if I used tabs to indent I want those tabs to be preserved. If my solution is copied and pasted somewhere, the base64 ensures that the the indentation I used is kept intact.

It's slightly shorter than the original code.

I wanted to introduce readers of the solution to things they may not have seen before.

1. Unquoted here documents are subject to bash parameter expansion, command substitution, arithmetic expansion, the character sequence \newline is ignored, and \ must be used to quote characters such as \ $ `. Hence you have no guarantee that the right contents will end up in setx.c.

None of those are present in this case, though.

2. I want the contents of setx.c to be exactly bit by bit perfect to the original code that I wrote. So if I used tabs to indent I want those tabs to be preserved. If my solution is copied and pasted somewhere, the base64 ensures that the the indentation I used is kept intact.

You shouldn't be using tabs in source code anyway. :-P

3. It's slightly shorter than the original code.

True. If you bear in mind that "{ base64 -d | gzip -d; }" is longer than "cat", your version saves 2 bytes.

4. I wanted to introduce readers of the solution to things they may not have seen before.

Unquoted here documents are subject to bash parameter expansion, command substitution, arithmetic expansion, the character sequence \newline is ignored, and \ must be used to quote characters such as \ $ `. Hence you have no guarantee that the right contents will end up in setx.c.

It looks like they created the account just to post this answer. I can only assume they were under duress after having valiantly siphoned off files from a crippled box. This was one of /u/throw_away5046's many war stories, to be told across reddit under a new alias every day.

Thanks. Yeah I should have realized I could just use fileglobs directly. I use that day to day, but somehow got stuck in a mode of thinking that echo was my golden hammer (tsk tsk) when I was on this crippled box.

Afaik you still have a reference to the dentry in memory, so the inode cache will still have the inode of the executable file and you could still have copied the deleted executables from that /proc/pid/exe path, as it will use the corresponding cached dentry.