Tag Info

Hot answers tagged

51

LVM is designed in a way that keeps it from really getting in the way very much. From the userspace point of view, it looks like another layer of "virtual stuff" on top of the disk, and it seems natural to imagine that all of the I/O has to now pass through this before it gets to or from the real hardware. But it's not like that. The kernel already needs to ...


48

Even as root, you can't execute files that have no x permission bit set. What you can do though is call ld.so on it: sudo /lib/*/ld*.so /bin/chmod 755 /bin /bin/chmod Or call something in /usr/bin or elsewhere to do the chmod like perl: sudo perl -e 'chmod 0755, "/bin", "/bin/chmod" Beware when restoring permissions that some files in /bin like mount ...


24

You can use SSHFS to mount a remote home in a local folder. Has the advantage of using the current infrastructure and low latency of local vim.


23

rm /* should delete very little. There is no -r flag in there that would recursively delete anything, and without it directories will not be deleted (and even if directories were deleted, only empty ones can be deleted). This answer is predicated on the assumption that you did not run rm -rf /*. The only files in the root filesystem of consequence may be ...


22

Boot another clean OS, mount the file system and fix permissions. As your broken file system lives in a VM, you should have your host system available and working. Mount your broken file system there and fix it. In case of QEMU/KVM you can for example mount the file system using nbd.


20

To run a service without or before logging in to the system (i.e. "on boot"), you will need to create a startup script and add it to the boot sequence. There's three parts to a service script: start, stop and restart. The basic structure of a service script is: #!/bin/bash # RETVAL=0; start() { echo “Starting <Service>” } stop() { echo “Stopping ...


20

sudo python -m SimpleHTTPServer 80 for python 3.x version, you may need : sudo python -m http.server 80 Ports below 1024 require root privileges. As George added in a comment, running this command as root is not a good idea - it opens up all kinds of security vulnerabilities. However, it answers the question.


20

python -m SimpleHTTPServer should do it.


18

If you need to recover files from the current install, ask your host to help you. Assuming it's a VM, it takes about five minutes of their day to image your disk, reinstall your host from scratch and dump the old disk image in your new filesystem. If you don't need anything, just get them to reinstall. Almost always the faster option when you bone things ...


16

Depending on init system, you create init script differently. Fedora gives you upstart and systemd to choose from, and of course SysV compatibility. Upstart create service definition file as /etc/init/custom-tomcat.conf put inside: start on stopped rc RUNLEVEL=3 respawn exec /path/to/you/tomcat --and --parameters And you Tomcat should ...


16

You can edit remotely with a local vim or gvim. :e scp://me@someplace.else/~/myfiles/whatever.file scp is a secure copy protocol. It authenticates the same way as ssh, so your ssh key needs to be available, etc. There are various other protocols supported (see :help netrw-externapp) but scp is probably the easiest if you are already using ssh to the ...


13

One of the things that RHEL/CentOS (and other Enterprise Linux products) provides that other distros don't provide is API/ABI stability. This is a frustration to a lot of people who are new to RHEL, because all they see is that the versions available are all older than the latest releases found in the latest release of Ubuntu/Fedora/Gentoo/Whatever. But, ...


11

A user's home directory is the initial directory when a user logs in. Normally the user may create files and directories only in in home directory (apart from temporary directories). Also various settings (user specific startup files and such) are usually stored in the user's home directory. Server is just annother name for a host (a computer). Think of a ...


11

The closest equivalents that I can think of are VirtualBox or Xen. Wikipedia has a list of virtual machine softwares.


11

If you are running a web server which allows server side scripting (php, ruby, etc), this is very easy to do. All the user has to do is generate a script which downloads a file to /tmp/sh64 and then runs it. Web scripts commonly need to be able to execute external programs, and so this sort of activity is difficult to prevent. If the mick account is the ...


10

Have you tried adding the kernel options "acpi=off apm=off" to the GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub? Then run sudo update-grub and reboot your computer.


10

Yes, you can automate the authentication with your Raspberry Pi using SSH. As prerequisites the following is required: You have enabled SSH on the Pi. You know your Pi's IP Address. Linux Under Linux you can install SSH via you package manager, generate a keypair using ssh-keygen, copy the key to the Pi using ssh-copy-id and test using ssh. Install ...


9

There are several choices of minimal, relay-only mail transfer agents (MTAs, or "mail servers"), some of which have been mentioned in other answers: msmtp http://msmtp.sourceforge.net/ nullmailer http://untroubled.org/nullmailer/ (my personal favourite) esmtp http://esmtp.sourceforge.net/ (unmaintained) sSMTP http://packages.debian.org/source/sid/ssmtp (no ...


9

Assuming you need a program you can run from the shell like sendmail(8), perhaps MSMTP will fit your needs? It can connect to a remote SMTP server and submit mail it gets as stdin, just like sendmail.


9

Here's a couple: run Linux as your primary operating system, on both your desktop and your laptop, if any install KVM and virt-manager and build a couple of virtual machines build a package for your distro of choice (a .deb or .rpm file); it helps in understanding a lot of things build your own kernel These might not seem directly related to your own ...


9

LVM, like everything else, is a mixed blessing. With respect to performance, LVM will hinder you a little bit because it is another layer of abstraction that has to be worked out before bits hit (or can be read from) the disk. In most situations, this performance hit will be practically unmeasurable. The advantages of LVM include the fact that you can add ...


9

SELinux enhanced local security by improving the isolation between processes and providing more fine-grained security policies. For multi-user machines, this can be useful because of the more flexible policies, and it raises more barriers between users so it adds protection against malicious local users. For servers, SELinux can reduce the impact of a ...


9

There are two reasons lsof | wc -l doesn't count file descriptors. One is that it lists things that aren't open files, such as loaded dynamically linked libraries and current working directories; you need to filter them out. Another is that lsof takes some time to run, so can miss files that are opened or closed while it's running; therefore the number of ...


8

I'm not sure how "on topic" this question is but I think that it is fun. The more of your computing that you move into Linux, the faster you will start to pick things up. Here is something I did shortly after moving to using Linux exclusively. It requires having a spare computer. Set up a server with Ubuntu Server. Set up SSH access to the server. ...


8

What you're looking for is called a quota. I suggest you start here.


8

If you have a separate server to run your check script on, something like this would do a simple Ping test to see if the server is alive: #!/bin/bash SERVERIP=192.168.2.3 NOTIFYEMAIL=test@example.com ping -c 3 $SERVERIP > /dev/null 2>&1 if [ $? -ne 0 ] then # Use your favorite mailer here: mailx -s "Server $SERVERIP is down" -t ...


8

Use python :) $ python >>> import os >>> os.chmod('/bin', 0755) That shouldn't need anything from /bin to do its job. Obviously, I haven't tried this out...


7

Change the setuid bit of mysqld executable and the ownership of the executable file to mysql account, besides adding the required user in the group mysql for making him have access to the files on the filesystem. Use visudo -f /etc/sudoers and grant him permission to execute the /etc/rc.d/init.d/mysql start and /etc/rc.d/init.d/mysql stop as two seperate ...


7

Use node.js , fast and lightweight. Or just use simple nc netcat command to start a quick webserver on a port and serve the content of a file including the server response headers. Reference from Wikipedia: http://en.wikipedia.org/wiki/Netcat#Setting_up_a_one-shot_webserver_on_port_8080_to_present_the_content_of_a_file { echo -ne "HTTP/1.0 200 ...


7

Creating an ha environment has a lot of caveats and is complicated, and often times depends on the actual software (e.g. creating a master-slave environment for mysql is different than for postfix0 If you want to get started and only want to have two systems and don't have time to configure all your daemons accordingly you should have a look at drbd, raid-1 ...



Only top voted, non community-wiki answers of a minimum length are eligible