0

Suppose you have write access to a Linux system, with root rights, but no interactive shell.

You can only write new files or overwrite existing files. Creation of (sub)directories is possible. It's possible to define file permissions.

How would you create a ba(sh) script, to be run after or at system boot?

edit: I do not have read permissions on the system either - only write permissions

1

That depends on what init setup the Linux system in question uses. All the more commonplace ones use text files (and lots of symbolic links) to determine what needs to be run at boot and in what order, whether that's a bash script for sysvinit or a systemd unit file or something for runit or upstart or whatnot.

Figure out which init system is being used, then write an init file of the appropriate type with the instructions you want, and drop it into the appropriate directory.

Without more information than you're providing in your hypothetical question it's hard to give a more specific answer.

  • I don't know what Linux the system is using, thus my vague question. Thank you for your input – SaAtomic Feb 3 '17 at 10:28
  • Then I recommend you look around /etc and see if you recognize some of the subdirectories as patterns. Alternately, see if /sbin/init is a symlink, and if so, to what. – Shadur Feb 3 '17 at 10:30
  • As mentioned in the question, I have no interactive shell on the system, only write access - so figuring out what Linux is running is kind of hard. – SaAtomic Feb 3 '17 at 10:32
  • hence my comment about looking at /sbin/init -- presumably, you have read access as well, or at least directory read access, or you wouldn't be able to know what you're uploading. – Shadur Feb 3 '17 at 10:38
  • unfortunately I really only have write access.. – SaAtomic Feb 3 '17 at 11:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.