diff --git a/install_wolf.sh b/install_wolf.sh
index 0f0bc2dd2388f247fbd4d32b9437de89039357a0..a1094614faaa9d1f7ba5c6d15835dd008ce0710c 100755
--- a/install_wolf.sh
+++ b/install_wolf.sh
@@ -10,6 +10,14 @@ func_make_install () {
    fi
 }
 
+func_ldconfig () {
+   if [ "$UID" -eq 0 -o "$EUID" -eq 0 ]; then
+      ldconfig
+   else
+      sudo ldconfig
+   fi
+}
+
 func_echo () {
    if [ $VERBOSE == "true" ]; then
       echo "$1"
@@ -140,6 +148,8 @@ while getopts "vap:d:w:hf:c:" opt; do
    esac
 done
 
+# check sudo permissions
+func_ldconfig
 
 # UBUNTU
 if [ "$UID" -eq 0 -o "$EUID" -eq 0 ]; then
@@ -354,7 +364,7 @@ if [ $INSTALL_LASER == "y" ]; then
    # LASER_SCAN_UTILS
    func_echo "Installing laser_scan_utils (required)..."
    cd $DEPS_PATH
-   ldconfig
+   func_ldconfig
    git clone https://gitlab.iri.upc.edu/labrobotica/algorithms/laser_scan_utils.git
    cd laser_scan_utils
    mkdir -p build && cd build
@@ -366,7 +376,7 @@ if [ $INSTALL_LASER == "y" ]; then
    # PLUGIN
    func_echo "Cloning plugin laser..."
    cd $WOLF_PATH
-   ldconfig
+   func_ldconfig
    git clone -b master https://gitlab.iri.upc.edu/mobile_robotics/wolf_projects/wolf_lib/plugins/laser.git
    cd laser
 
@@ -379,7 +389,7 @@ if [ $INSTALL_LASER == "y" ]; then
    func_make_install
 
    func_echo "Testing plugin laser..."
-   ldconfig
+   func_ldconfig
    ctest -j$CORES
 else
    func_echo "Skipping plugin laser."